suneditor 3.0.0-beta.4 → 3.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +4 -2
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/core/class/offset.js +1 -1
- package/src/core/class/selection.js +4 -7
- package/src/core/editor.js +1 -1
- package/src/editorInjector/_core.js +0 -5
- package/src/editorInjector/index.js +0 -2
- package/src/modules/Controller.js +1 -1
- package/types/core/editor.d.ts +4 -2
- package/types/editorInjector/_core.d.ts +0 -5
- package/types/editorInjector/index.d.ts +0 -2
package/package.json
CHANGED
package/src/core/class/offset.js
CHANGED
|
@@ -288,7 +288,7 @@ Offset.prototype = {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
el = /** @type {HTMLElement} */ (this._shadowRoot?.host);
|
|
291
|
+
el = /** @type {HTMLElement} */ (this.editor._shadowRoot?.host);
|
|
292
292
|
if (el) ohOffsetEl = owOffsetEl = topArea;
|
|
293
293
|
while (el) {
|
|
294
294
|
t += el.scrollTop;
|
|
@@ -37,15 +37,12 @@ Selection_.prototype = {
|
|
|
37
37
|
* @returns {Selection}
|
|
38
38
|
*/
|
|
39
39
|
get() {
|
|
40
|
-
const wSelection = this.editor.frameContext.get('_ww').getSelection();
|
|
41
40
|
let selection = null;
|
|
42
41
|
|
|
43
|
-
if (this._shadowRoot) {
|
|
44
|
-
selection =
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!selection) {
|
|
48
|
-
selection = wSelection;
|
|
42
|
+
if (typeof this.editor._shadowRoot?.getSelection === 'function') {
|
|
43
|
+
selection = this.editor._shadowRoot.getSelection();
|
|
44
|
+
} else {
|
|
45
|
+
selection = this.editor.frameContext.get('_ww').getSelection();
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
if (!selection) return null;
|
package/src/core/editor.js
CHANGED
|
@@ -311,7 +311,7 @@ function Editor(multiTargets, options) {
|
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
313
|
* @description Closest ShadowRoot to editor if found
|
|
314
|
-
* @type {ShadowRoot}
|
|
314
|
+
* @type {ShadowRoot & { getSelection?: () => Selection }} - Chromium-based browsers (Chrome, Edge, etc.) has a getSelection method on the ShadowRoot
|
|
315
315
|
*/
|
|
316
316
|
this._shadowRoot = null;
|
|
317
317
|
|
|
@@ -37,8 +37,6 @@ function EditorInjector(editor) {
|
|
|
37
37
|
this._w;
|
|
38
38
|
/** @type {import('./_core').default['_d']} */
|
|
39
39
|
this._d;
|
|
40
|
-
/** @type {import('./_core').default['_shadowRoot']} */
|
|
41
|
-
this._shadowRoot;
|
|
42
40
|
|
|
43
41
|
// ClassInjector props
|
|
44
42
|
/** @type {import('./_classes').default['toolbar']} */
|
|
@@ -235,7 +235,7 @@ class Controller extends EditorInjector {
|
|
|
235
235
|
if ((await this.triggerEvent('onBeforeShowController', { caller: this.kind, frameContext: this.editor.frameContext, info })) === false) return;
|
|
236
236
|
|
|
237
237
|
form.style.display = 'block';
|
|
238
|
-
if (this._shadowRoot) {
|
|
238
|
+
if (this.editor._shadowRoot) {
|
|
239
239
|
this.__shadowRootEventForm = form;
|
|
240
240
|
this.__shadowRootEventListener = (e) => e.stopPropagation();
|
|
241
241
|
form.addEventListener('mousedown', this.__shadowRootEventListener);
|
package/types/core/editor.d.ts
CHANGED
|
@@ -266,9 +266,11 @@ declare class Editor {
|
|
|
266
266
|
_lineBreaker_b: HTMLElement;
|
|
267
267
|
/**
|
|
268
268
|
* @description Closest ShadowRoot to editor if found
|
|
269
|
-
* @type {ShadowRoot}
|
|
269
|
+
* @type {ShadowRoot & { getSelection?: () => Selection }} - Chromium-based browsers (Chrome, Edge, etc.) has a getSelection method on the ShadowRoot
|
|
270
270
|
*/
|
|
271
|
-
_shadowRoot: ShadowRoot
|
|
271
|
+
_shadowRoot: ShadowRoot & {
|
|
272
|
+
getSelection?: () => Selection;
|
|
273
|
+
};
|
|
272
274
|
/**
|
|
273
275
|
* @description Plugin call event map
|
|
274
276
|
* @type {Map<string, Array<((...args: *) => *) & { index: number }>>}
|
|
@@ -40,8 +40,6 @@ declare class EditorInjector {
|
|
|
40
40
|
_w: import('./_core').default['_w'];
|
|
41
41
|
/** @type {import('./_core').default['_d']} */
|
|
42
42
|
_d: import('./_core').default['_d'];
|
|
43
|
-
/** @type {import('./_core').default['_shadowRoot']} */
|
|
44
|
-
_shadowRoot: import('./_core').default['_shadowRoot'];
|
|
45
43
|
/** @type {import('./_classes').default['toolbar']} */
|
|
46
44
|
toolbar: import('./_classes').default['toolbar'];
|
|
47
45
|
/** @type {import('./_classes').default['subToolbar']} */
|