dragon-editor 3.5.15 → 3.5.17

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.5.15",
7
+ "version": "3.5.17",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -47,12 +47,10 @@ const editorStore = ref<DragonEditorStore>({
47
47
  imageResizeEvent: false,
48
48
  },
49
49
  eventStatus: {
50
- preComposing: false,
51
50
  imageResizeEventStartX: 0,
52
51
  imageResizeEventType: "left",
53
52
  imageResizeEventEndX: 0,
54
53
  imageResizeCurrentWidth: 0,
55
- keyboardEnterCount: 0,
56
54
  },
57
55
  controlStatus: {
58
56
  isMobile: false,
@@ -379,12 +377,15 @@ defineExpose({
379
377
  .dragon-editor.--mobile .de-menu-bar .de-menu-wrap {
380
378
  overflow-x: auto;
381
379
  }
380
+ .dragon-editor.--mobile .de-menu-bar .de-link-exit-area {
381
+ left: auto;
382
+ right: 0;
383
+ }
382
384
  .dragon-editor .de-body {
383
385
  display: flex;
384
386
  flex-direction: column;
385
- gap: 4px;
386
387
  min-height: 500px;
387
- padding: 20px;
388
+ padding: 16px 20px;
388
389
  line-height: 1.6;
389
390
  }
390
391
  .dragon-editor .de-menu-bar {
@@ -400,6 +401,7 @@ defineExpose({
400
401
  }
401
402
  .dragon-editor .de-menu-bar .de-menu-wrap {
402
403
  display: flex;
404
+ overflow-x: auto;
403
405
  }
404
406
  .dragon-editor .de-menu-bar .de-col {
405
407
  display: flex;
@@ -462,14 +464,13 @@ defineExpose({
462
464
  display: none;
463
465
  position: absolute;
464
466
  top: calc(100% + 1px);
465
- left: 50%;
467
+ left: 205px;
466
468
  width: 200px;
467
469
  background: #fff;
468
470
  border: 1px solid #ccc;
469
471
  border-top: 0;
470
472
  border-radius: 0 0 var(--radius-default) var(--radius-default);
471
473
  z-index: 1000;
472
- transform: translateX(-50%);
473
474
  }
474
475
  .dragon-editor .de-menu-bar .de-link-exit-area.--active {
475
476
  display: block;
@@ -548,10 +549,12 @@ defineExpose({
548
549
  }
549
550
  .dragon-editor .de-block {
550
551
  width: 100%;
552
+ padding: 2px 0;
551
553
  box-sizing: border-box;
552
554
  }
553
555
  .dragon-editor .de-text-block {
554
556
  min-height: 1.6em;
557
+ word-break: break-all;
555
558
  outline: 0;
556
559
  }
557
560
  .dragon-editor .de-text-block:empty:hover::before, .dragon-editor .de-text-block:empty:focus::before {
@@ -562,6 +565,7 @@ defineExpose({
562
565
  }
563
566
  .dragon-editor .de-heading-block {
564
567
  min-height: 1.6em;
568
+ word-break: break-all;
565
569
  outline: 0;
566
570
  }
567
571
  .dragon-editor .de-heading-block[data-level="1"] {
@@ -608,6 +612,7 @@ defineExpose({
608
612
  }
609
613
  .dragon-editor .de-list-block .de-item {
610
614
  min-height: 1.6em;
615
+ word-break: break-all;
611
616
  outline: 0;
612
617
  list-style: inherit;
613
618
  }
@@ -896,6 +901,7 @@ defineExpose({
896
901
  min-height: 1.6em;
897
902
  color: #909090;
898
903
  text-align: center;
904
+ word-break: break-all;
899
905
  outline: 0;
900
906
  }
901
907
  .dragon-editor .de-image-block .de-caption:empty:hover::before, .dragon-editor .de-image-block .de-caption:empty:focus::before {
@@ -912,6 +918,7 @@ defineExpose({
912
918
  }
913
919
  .dragon-editor .de-code-block .de-filename {
914
920
  flex: 1;
921
+ max-width: calc(100% - 120px);
915
922
  padding: 5px 10px;
916
923
  box-sizing: border-box;
917
924
  outline: 0;
@@ -201,14 +201,17 @@ function structure(): VNode {
201
201
  }
202
202
  .dragon-editor-viewer .de-block {
203
203
  width: 100%;
204
+ padding: 2px 0;
204
205
  box-sizing: border-box;
205
206
  }
206
207
  .dragon-editor-viewer .de-text-block {
207
208
  min-height: 1.6em;
209
+ word-break: break-all;
208
210
  outline: 0;
209
211
  }
210
212
  .dragon-editor-viewer .de-heading-block {
211
213
  min-height: 1.6em;
214
+ word-break: break-all;
212
215
  outline: 0;
213
216
  }
214
217
  .dragon-editor-viewer .de-heading-block[data-level="1"] {
@@ -249,6 +252,7 @@ function structure(): VNode {
249
252
  }
250
253
  .dragon-editor-viewer .de-list-block .de-item {
251
254
  min-height: 1.6em;
255
+ word-break: break-all;
252
256
  outline: 0;
253
257
  list-style: inherit;
254
258
  }
@@ -531,6 +535,7 @@ function structure(): VNode {
531
535
  min-height: 1.6em;
532
536
  color: #909090;
533
537
  text-align: center;
538
+ word-break: break-all;
534
539
  outline: 0;
535
540
  }
536
541
  .dragon-editor-viewer .de-code-block {
@@ -541,6 +546,7 @@ function structure(): VNode {
541
546
  }
542
547
  .dragon-editor-viewer .de-code-block .de-filename {
543
548
  flex: 1;
549
+ max-width: calc(100% - 120px);
544
550
  padding: 5px 10px;
545
551
  box-sizing: border-box;
546
552
  outline: 0;
@@ -166,12 +166,15 @@
166
166
  .dragon-editor.--mobile .de-menu-bar .de-menu-wrap {
167
167
  overflow-x: auto;
168
168
  }
169
+ .dragon-editor.--mobile .de-menu-bar .de-link-exit-area {
170
+ left: auto;
171
+ right: 0;
172
+ }
169
173
  .dragon-editor .de-body {
170
174
  display: flex;
171
175
  flex-direction: column;
172
- gap: 4px;
173
176
  min-height: 500px;
174
- padding: 20px;
177
+ padding: 16px 20px;
175
178
  line-height: 1.6;
176
179
  }
177
180
  .dragon-editor .de-menu-bar {
@@ -187,6 +190,7 @@
187
190
  }
188
191
  .dragon-editor .de-menu-bar .de-menu-wrap {
189
192
  display: flex;
193
+ overflow-x: auto;
190
194
  }
191
195
  .dragon-editor .de-menu-bar .de-col {
192
196
  display: flex;
@@ -249,14 +253,13 @@
249
253
  display: none;
250
254
  position: absolute;
251
255
  top: calc(100% + 1px);
252
- left: 50%;
256
+ left: 205px;
253
257
  width: 200px;
254
258
  background: #fff;
255
259
  border: 1px solid #ccc;
256
260
  border-top: 0;
257
261
  border-radius: 0 0 var(--radius-default) var(--radius-default);
258
262
  z-index: 1000;
259
- transform: translateX(-50%);
260
263
  }
261
264
  .dragon-editor .de-menu-bar .de-link-exit-area.--active {
262
265
  display: block;
@@ -335,10 +338,12 @@
335
338
  }
336
339
  .dragon-editor .de-block {
337
340
  width: 100%;
341
+ padding: 2px 0;
338
342
  box-sizing: border-box;
339
343
  }
340
344
  .dragon-editor .de-text-block {
341
345
  min-height: 1.6em;
346
+ word-break: break-all;
342
347
  outline: 0;
343
348
  }
344
349
  .dragon-editor .de-text-block:empty:hover::before, .dragon-editor .de-text-block:empty:focus::before {
@@ -349,6 +354,7 @@
349
354
  }
350
355
  .dragon-editor .de-heading-block {
351
356
  min-height: 1.6em;
357
+ word-break: break-all;
352
358
  outline: 0;
353
359
  }
354
360
  .dragon-editor .de-heading-block[data-level="1"] {
@@ -395,6 +401,7 @@
395
401
  }
396
402
  .dragon-editor .de-list-block .de-item {
397
403
  min-height: 1.6em;
404
+ word-break: break-all;
398
405
  outline: 0;
399
406
  list-style: inherit;
400
407
  }
@@ -683,6 +690,7 @@
683
690
  min-height: 1.6em;
684
691
  color: #909090;
685
692
  text-align: center;
693
+ word-break: break-all;
686
694
  outline: 0;
687
695
  }
688
696
  .dragon-editor .de-image-block .de-caption:empty:hover::before, .dragon-editor .de-image-block .de-caption:empty:focus::before {
@@ -699,6 +707,7 @@
699
707
  }
700
708
  .dragon-editor .de-code-block .de-filename {
701
709
  flex: 1;
710
+ max-width: calc(100% - 120px);
702
711
  padding: 5px 10px;
703
712
  box-sizing: border-box;
704
713
  outline: 0;
@@ -166,14 +166,17 @@
166
166
  }
167
167
  .dragon-editor-viewer .de-block {
168
168
  width: 100%;
169
+ padding: 2px 0;
169
170
  box-sizing: border-box;
170
171
  }
171
172
  .dragon-editor-viewer .de-text-block {
172
173
  min-height: 1.6em;
174
+ word-break: break-all;
173
175
  outline: 0;
174
176
  }
175
177
  .dragon-editor-viewer .de-heading-block {
176
178
  min-height: 1.6em;
179
+ word-break: break-all;
177
180
  outline: 0;
178
181
  }
179
182
  .dragon-editor-viewer .de-heading-block[data-level="1"] {
@@ -214,6 +217,7 @@
214
217
  }
215
218
  .dragon-editor-viewer .de-list-block .de-item {
216
219
  min-height: 1.6em;
220
+ word-break: break-all;
217
221
  outline: 0;
218
222
  list-style: inherit;
219
223
  }
@@ -496,6 +500,7 @@
496
500
  min-height: 1.6em;
497
501
  color: #909090;
498
502
  text-align: center;
503
+ word-break: break-all;
499
504
  outline: 0;
500
505
  }
501
506
  .dragon-editor-viewer .de-code-block {
@@ -506,6 +511,7 @@
506
511
  }
507
512
  .dragon-editor-viewer .de-code-block .de-filename {
508
513
  flex: 1;
514
+ max-width: calc(100% - 120px);
509
515
  padding: 5px 10px;
510
516
  box-sizing: border-box;
511
517
  outline: 0;
@@ -43,12 +43,10 @@ interface DragonEditorStore {
43
43
  imageResizeEvent: boolean;
44
44
  };
45
45
  eventStatus: {
46
- preComposing: boolean;
47
46
  imageResizeEventStartX: number;
48
47
  imageResizeEventType: "right" | "left";
49
48
  imageResizeEventEndX: number;
50
49
  imageResizeCurrentWidth: number;
51
- keyboardEnterCount: number;
52
50
  };
53
51
  controlStatus: {
54
52
  isMobile: boolean;
@@ -4,3 +4,4 @@ export declare function _imageResizeEventStart(event: Event, store: Ref<DragonEd
4
4
  export declare function _imageResizeEvent(event: Event, store: Ref<DragonEditorStore>): void;
5
5
  export declare function _imageResizeEventEnd(event: Event, store: Ref<DragonEditorStore>): void;
6
6
  export declare function _moveBlock(type: "up" | "down", store: Ref<DragonEditorStore>): void;
7
+ export declare function _checkNeedNewBlock(event: MouseEvent, store: Ref<DragonEditorStore>): void;
@@ -1,5 +1,5 @@
1
- import { _updateModelData } from "./index.js";
2
- import { _updateCurrentBlock } from "../node/index.js";
1
+ import { _updateModelData, _getDefaultBlockData } from "./index.js";
2
+ import { _updateCurrentBlock, _createTextBlock } from "../node/index.js";
3
3
  export function _imageResizeEventStart(event, store) {
4
4
  const $target = event.target;
5
5
  if ($target !== null) {
@@ -76,3 +76,26 @@ export function _moveBlock(type, store) {
76
76
  _updateModelData(store);
77
77
  }
78
78
  }
79
+ export function _checkNeedNewBlock(event, store) {
80
+ const $target = event.target;
81
+ if ($target !== null) {
82
+ const $element = $target;
83
+ if ($element.classList.contains("js-de-body") === true) {
84
+ const blockList = $element.querySelectorAll(".de-block");
85
+ const $targetBlock = blockList[blockList.length - 1];
86
+ if ($targetBlock.classList.contains("de-text-block") === true) {
87
+ if ($targetBlock.textContent === "") {
88
+ $targetBlock.focus();
89
+ } else {
90
+ const $block = _createTextBlock(_getDefaultBlockData("text"));
91
+ $targetBlock.insertAdjacentElement("afterend", $block);
92
+ $block.focus();
93
+ }
94
+ } else {
95
+ const $block = _createTextBlock(_getDefaultBlockData("text"));
96
+ $targetBlock.insertAdjacentElement("afterend", $block);
97
+ $block.focus();
98
+ }
99
+ }
100
+ }
101
+ }
@@ -7,16 +7,11 @@ export function _contentKeydownEvent(event, store) {
7
7
  _updateCursorData(store);
8
8
  switch (event.key) {
9
9
  case "Enter":
10
- if (store.value.eventStatus.preComposing === false && event.isComposing === false) {
10
+ if (event.isComposing === false) {
11
11
  __enterEvent(event, store);
12
12
  } else {
13
- if (store.value.eventStatus.keyboardEnterCount % 2 === 0) {
14
- __enterEvent(event, store);
15
- } else {
16
- event.preventDefault();
17
- }
13
+ event.preventDefault();
18
14
  }
19
- store.value.eventStatus.keyboardEnterCount += 1;
20
15
  break;
21
16
  case "Backspace":
22
17
  __backspaceEvent(event, store);
@@ -41,7 +36,6 @@ export function _contentKeydownEvent(event, store) {
41
36
  break;
42
37
  }
43
38
  _hotKeyEvent(event, store);
44
- store.value.eventStatus.preComposing = event.isComposing;
45
39
  }
46
40
  export async function _contentPasteEvent(event, store) {
47
41
  event.preventDefault();
@@ -1335,7 +1329,6 @@ export function _contentKeyupEvent(event, store) {
1335
1329
  _updateCurrentBlock(event, store);
1336
1330
  _updateCursorData(store);
1337
1331
  __checkBlock(store);
1338
- store.value.eventStatus.keyboardEnterCount = 0;
1339
1332
  clearTimeout(contentKeyupEvent);
1340
1333
  contentKeyupEvent = setTimeout(() => {
1341
1334
  _updateModelData(store);
@@ -1,9 +1,10 @@
1
- import { _updateCursorData, _imageResizeEventStart, _imageResizeEvent, _imageResizeEventEnd } from "./index.js";
1
+ import { _updateCursorData, _imageResizeEventStart, _imageResizeEvent, _imageResizeEventEnd, _checkNeedNewBlock } from "./index.js";
2
2
  import { _getCurrentBlock, _updateCurrentBlock, _updateHeadingBlockList } from "../node/index.js";
3
3
  import { _updateAnchorTagValue } from "../style/index.js";
4
4
  export function _contentMouseupEvent(event, store) {
5
5
  _updateCurrentBlock(event, store);
6
6
  _updateCursorData(store);
7
+ _checkNeedNewBlock(event, store);
7
8
  }
8
9
  export function _contentMousedownEvnet(event, store) {
9
10
  _imageResizeEventStart(event, store);
@@ -7,6 +7,59 @@ export function _getMenuBarVNodeStructure(store) {
7
7
  const childNode = [];
8
8
  childNode.push(__getMenuListStructure(store));
9
9
  childNode.push(__getBlockListStructure(store));
10
+ childNode.push(
11
+ h("div", { class: ["de-link-exit-area", "js-de-link-exit-area", { "--active": store.value.activeStatus.anchorInputArea }] }, [
12
+ h("div", { class: ["de-btn-area"] }, [
13
+ h(
14
+ "button",
15
+ {
16
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "url" }],
17
+ onClick: () => {
18
+ store.value.controlStatus.anchorTabType = "url";
19
+ }
20
+ },
21
+ "Text"
22
+ ),
23
+ h(
24
+ "button",
25
+ {
26
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "heading" }],
27
+ onClick: () => {
28
+ store.value.controlStatus.anchorTabType = "heading";
29
+ }
30
+ },
31
+ "Heading"
32
+ )
33
+ ]),
34
+ store.value.controlStatus.anchorTabType === "url" ? h("div", { class: ["de-link-text-area"] }, [
35
+ h("input", {
36
+ class: ["de-input", { "--error": store.value.controlStatus.anchorValidation === false }],
37
+ value: store.value.controlStatus.anchorHref,
38
+ onChange: (event) => {
39
+ store.value.controlStatus.anchorHref = event.currentTarget.value;
40
+ }
41
+ }),
42
+ h("button", { class: ["de-btn"], onClick: () => {
43
+ } }, "Set")
44
+ ]) : h(
45
+ "div",
46
+ { class: ["de-link-heading-area"] },
47
+ store.value.controlStatus.anchorHeadingList.map((item) => {
48
+ return h(
49
+ "button",
50
+ {
51
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorHref === `#${item.id}` }],
52
+ onClick: () => {
53
+ store.value.activeStatus.anchorInputArea = false;
54
+ _setAnchorTag(item.id, false, store);
55
+ }
56
+ },
57
+ item.name
58
+ );
59
+ })
60
+ )
61
+ ])
62
+ );
10
63
  return h("div", { class: ["de-menu-bar"], style: { top: `${store.value.menuBarTop}px` } }, childNode);
11
64
  }
12
65
  function __getMenuListStructure(store) {
@@ -100,58 +153,7 @@ function __getMenuListStructure(store) {
100
153
  }
101
154
  },
102
155
  [_getIconNode("remove-link")]
103
- ),
104
- h("div", { class: ["de-link-exit-area", "js-de-link-exit-area", { "--active": store.value.activeStatus.anchorInputArea }] }, [
105
- h("div", { class: ["de-btn-area"] }, [
106
- h(
107
- "button",
108
- {
109
- class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "url" }],
110
- onClick: () => {
111
- store.value.controlStatus.anchorTabType = "url";
112
- }
113
- },
114
- "Text"
115
- ),
116
- h(
117
- "button",
118
- {
119
- class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "heading" }],
120
- onClick: () => {
121
- store.value.controlStatus.anchorTabType = "heading";
122
- }
123
- },
124
- "Heading"
125
- )
126
- ]),
127
- store.value.controlStatus.anchorTabType === "url" ? h("div", { class: ["de-link-text-area"] }, [
128
- h("input", {
129
- class: ["de-input", { "--error": store.value.controlStatus.anchorValidation === false }],
130
- value: store.value.controlStatus.anchorHref,
131
- onChange: (event) => {
132
- store.value.controlStatus.anchorHref = event.currentTarget.value;
133
- }
134
- }),
135
- h("button", { class: ["de-btn"], onClick: () => {
136
- } }, "Set")
137
- ]) : h(
138
- "div",
139
- { class: ["de-link-heading-area"] },
140
- store.value.controlStatus.anchorHeadingList.map((item) => {
141
- return h(
142
- "button",
143
- {
144
- class: ["de-btn", { "--active": store.value.controlStatus.anchorHref === `#${item.id}` }],
145
- onClick: () => {
146
- store.value.activeStatus.anchorInputArea = false;
147
- _setAnchorTag(item.id, false, store);
148
- }
149
- },
150
- item.name
151
- );
152
- })
153
- )
154
- ])
156
+ )
155
157
  ])
156
158
  );
157
159
  menuGroupNode.push(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
- "version": "3.5.15",
3
+ "version": "3.5.17",
4
4
  "description": "Javascript WYSIWYG editor in Nuxt3!",
5
5
  "repository": {
6
6
  "type": "git",