mirror of
https://github.com/codex-team/editor.js
synced 2024-05-10 02:16:46 +02:00
Prevent the leak of codex-tooltip when Editor.js is destroyed (#1590)
* Prevent the leak of codex-tooltip when Editor.js is destroyed * Cover destroy() function Thanks, @hata6502
This commit is contained in:
parent
32ac52a62f
commit
04749ed098
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
### 2.20.2
|
||||
|
||||
- `Fix` - Prevent the leak of codex-tooltip when Editor.js is destroyed [#1475](https://github.com/codex-team/editor.js/issues/1475).
|
||||
|
||||
### 2.20.1
|
||||
|
||||
- `Fix` - Create a new block when clicked at the bottom [#1588](https://github.com/codex-team/editor.js/issues/1588).
|
||||
|
@ -14,7 +18,6 @@
|
|||
|
||||
- `New` — [Block Tunes API](block-tunes.md) added
|
||||
|
||||
|
||||
### 2.19.3
|
||||
|
||||
- `Fix` — Ignore error raised by Shortcut module
|
||||
|
|
|
@ -87,6 +87,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"codex-notifier": "^1.1.2",
|
||||
"codex-tooltip": "^1.0.1"
|
||||
"codex-tooltip": "^1.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,13 @@ export default class TooltipAPI extends Module {
|
|||
this.tooltip = new Tooltip();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Module
|
||||
*/
|
||||
public destroy(): void {
|
||||
this.tooltip.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Available methods
|
||||
*/
|
||||
|
|
|
@ -406,5 +406,6 @@ export default class Toolbar extends Module<ToolbarNodes> {
|
|||
*/
|
||||
private destroy(): void {
|
||||
this.removeAllNodes();
|
||||
this.tooltip.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,6 +298,7 @@ export default class InlineToolbar extends Module<InlineToolbarNodes> {
|
|||
}
|
||||
|
||||
this.removeAllNodes();
|
||||
this.tooltip.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,6 +128,7 @@ export default class Toolbox extends Module<ToolboxNodes> {
|
|||
|
||||
this.removeAllNodes();
|
||||
this.removeAllShortcuts();
|
||||
this.tooltip.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -661,6 +661,8 @@ export function cacheable<Target, Value, Arguments extends any[] = any[]>(
|
|||
|
||||
/**
|
||||
* Override get or value descriptor property to cache return value
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
descriptor[propertyToOverride] = function (...args: Arguments): Value {
|
||||
/**
|
||||
|
@ -675,6 +677,8 @@ export function cacheable<Target, Value, Arguments extends any[] = any[]>(
|
|||
|
||||
/**
|
||||
* If get accessor has been overridden, we need to override set accessor to clear cache
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
if (propertyToOverride === 'get' && descriptor.set) {
|
||||
const originalSet = descriptor.set;
|
||||
|
|
|
@ -117,7 +117,6 @@ function deepSanitize(dataToSanitize: object | string, rules: SanitizerConfig):
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean array
|
||||
*
|
||||
|
@ -186,6 +185,3 @@ function cleanOneItem(taintString: string, rule: SanitizerConfig|boolean): strin
|
|||
function isRule(config: SanitizerConfig): boolean {
|
||||
return _.isObject(config) || _.isBoolean(config) || _.isFunction(config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,13 @@ export default class Tooltip {
|
|||
*/
|
||||
private lib: CodeXTooltips = new CodeXTooltips();
|
||||
|
||||
/**
|
||||
* Release the library
|
||||
*/
|
||||
public destroy(): void {
|
||||
this.lib.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows tooltip on element with passed HTML content
|
||||
*
|
||||
|
|
|
@ -2956,10 +2956,10 @@ codex-notifier@^1.1.2:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/codex-notifier/-/codex-notifier-1.1.2.tgz#a733079185f4c927fa296f1d71eb8753fe080895"
|
||||
|
||||
codex-tooltip@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/codex-tooltip/-/codex-tooltip-1.0.1.tgz#f6e4f39d81507f9c455b667f1287746d14ee8056"
|
||||
integrity sha512-1xLb1NZbxguNtf02xBRhDphq/EXvMMeEbY0ievjQTHqf8UjXsD41evGk9rqcbjpl+JOjNgtwnp1OaU/X/h6fhQ==
|
||||
codex-tooltip@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/codex-tooltip/-/codex-tooltip-1.0.2.tgz#81a9d3e2937658c6e5312106b47b9f094ff7be63"
|
||||
integrity sha512-oC+Bu5X/zyhbPydgMSLWKoM/+vkJMqaLWu3Dt/jZgXS3MWK23INwC5DMBrVXZSufAFk0i0SUni38k9rLMyZn/w==
|
||||
|
||||
coffeeify@3.0.1:
|
||||
version "3.0.1"
|
||||
|
|
Loading…
Reference in a new issue