dragon-editor 3.8.3 → 3.8.4

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.0.0"
5
5
  },
6
6
  "configKey": "dragon-editor",
7
- "version": "3.8.3",
7
+ "version": "3.8.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -46,6 +46,7 @@ const editorStore = ref({
46
46
  controlStatus: {
47
47
  isMobile: false,
48
48
  hasTransformParent: false,
49
+ hasHiddenStyleParent: false,
49
50
  currentBlockType: "text",
50
51
  codeBlockTheme: "github-light",
51
52
  codeBlockLang: "text",
@@ -132,7 +133,7 @@ function mainStrucutre() {
132
133
  return h(
133
134
  "div",
134
135
  {
135
- class: ["dragon-editor", "js-dragon-editor", { "--has-menu": editorStore.value.useMenuBar === true }, { "--mobile": editorStore.value.controlStatus.isMobile === true }],
136
+ class: ["dragon-editor", "js-dragon-editor", { "--has-menu": editorStore.value.useMenuBar === true }, { "--mobile": editorStore.value.controlStatus.isMobile === true }, { "--hidden-parent": editorStore.value.controlStatus.hasHiddenStyleParent === true }],
136
137
  onMousemove: (event) => _editorMousemoveEvent(event, editorStore),
137
138
  onMouseup: (event) => _editorMouseupEvent(event, editorStore),
138
139
  onMouseleave: (event) => _editorMouseleaveEvent(event, editorStore),
@@ -384,6 +385,15 @@ defineExpose({
384
385
  left: auto;
385
386
  right: 0;
386
387
  }
388
+ .dragon-editor.--hidden-parent {
389
+ height: 100%;
390
+ box-sizing: border-box;
391
+ }
392
+ .dragon-editor.--hidden-parent .de-body {
393
+ height: 100%;
394
+ overflow-y: auto;
395
+ box-sizing: border-box;
396
+ }
387
397
  .dragon-editor .de-body {
388
398
  display: flex;
389
399
  flex-direction: column;
@@ -173,6 +173,15 @@
173
173
  left: auto;
174
174
  right: 0;
175
175
  }
176
+ .dragon-editor.--hidden-parent {
177
+ height: 100%;
178
+ box-sizing: border-box;
179
+ }
180
+ .dragon-editor.--hidden-parent .de-body {
181
+ height: 100%;
182
+ overflow-y: auto;
183
+ box-sizing: border-box;
184
+ }
176
185
  .dragon-editor .de-body {
177
186
  display: flex;
178
187
  flex-direction: column;
@@ -52,6 +52,7 @@ interface DragonEditorStore {
52
52
  controlStatus: {
53
53
  isMobile: boolean;
54
54
  hasTransformParent: boolean;
55
+ hasHiddenStyleParent: boolean;
55
56
  anchorValidation: boolean;
56
57
  currentBlockType: DEBlock;
57
58
  codeBlockTheme: DECodeblockTheme;
@@ -1,20 +1,26 @@
1
- import { _findScrollingElement, _findTransformElement } from "../node/index.js";
1
+ import { _findScrollingElement, _findTransformElement, _findHiddenStyleElement } from "../node/index.js";
2
2
  export function _eidtorMountEvent(store) {
3
3
  const $editor = document.querySelector(".js-dragon-editor");
4
4
  const $body = document.querySelector(".js-de-body");
5
5
  const $controlBar = document.querySelector(".js-de-controlbar");
6
6
  const $parentWrap = _findScrollingElement($editor);
7
- const $transformWrap = _findTransformElement($editor);
7
+ const $hiddenStyleElement = _findHiddenStyleElement($editor);
8
+ const $transformElement = _findTransformElement($editor);
8
9
  store.value.$editor = $editor;
9
10
  store.value.$body = $body;
10
11
  store.value.$controlBar = $controlBar;
11
12
  store.value.$parentWrap = $parentWrap;
12
- if ($transformWrap === null) {
13
+ if ($hiddenStyleElement === $editor.parentElement) {
14
+ store.value.controlStatus.hasHiddenStyleParent = true;
15
+ } else {
16
+ store.value.controlStatus.hasHiddenStyleParent = false;
17
+ }
18
+ if ($transformElement === null) {
13
19
  store.value.controlStatus.hasTransformParent = false;
14
20
  store.value.controlStatus.$transformElement = null;
15
21
  } else {
16
22
  store.value.controlStatus.hasTransformParent = true;
17
- store.value.controlStatus.$transformElement = $transformWrap;
23
+ store.value.controlStatus.$transformElement = $transformElement;
18
24
  }
19
25
  __checkAndSetUpMobile(store);
20
26
  window.addEventListener("click", store.value.windowClickEvent);
@@ -1,4 +1,5 @@
1
1
  export declare function _findScrollingElement($target: HTMLElement): HTMLElement | Window;
2
+ export declare function _findHiddenStyleElement($target: HTMLElement): HTMLElement | null;
2
3
  export declare function _findTransformElement($target: HTMLElement): HTMLElement | null;
3
4
  export declare function _getParentElementIfNodeIsText($target: Node, $block: HTMLElement): Node;
4
5
  export declare function _findContentEditableElement($target: Node): HTMLElement | null;
@@ -2,7 +2,7 @@ export function _findScrollingElement($target) {
2
2
  const $wrap = $target.parentElement;
3
3
  if ($wrap !== null) {
4
4
  const style = window.getComputedStyle($wrap);
5
- if (style.overflow !== "visible") {
5
+ if (style.overflow !== "visible" && style.overflow !== "hidden") {
6
6
  return $wrap;
7
7
  } else {
8
8
  if ($wrap.tagName === "BODY") {
@@ -15,6 +15,23 @@ export function _findScrollingElement($target) {
15
15
  return window;
16
16
  }
17
17
  }
18
+ export function _findHiddenStyleElement($target) {
19
+ const $wrap = $target.parentElement;
20
+ if ($wrap !== null) {
21
+ const style = window.getComputedStyle($wrap);
22
+ if (style.overflow === "hidden") {
23
+ return $wrap;
24
+ } else {
25
+ if ($wrap.tagName === "HTML") {
26
+ return null;
27
+ } else {
28
+ return _findHiddenStyleElement($wrap);
29
+ }
30
+ }
31
+ } else {
32
+ return null;
33
+ }
34
+ }
18
35
  export function _findTransformElement($target) {
19
36
  const $wrap = $target.parentElement;
20
37
  if ($wrap !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
- "version": "3.8.3",
3
+ "version": "3.8.4",
4
4
  "description": "Javascript WYSIWYG editor in Nuxt!",
5
5
  "repository": {
6
6
  "type": "git",