dragon-editor 3.5.20 → 3.5.21
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 +1 -1
- package/dist/runtime/utils/event/mouse.d.ts +1 -1
- package/dist/runtime/utils/event/mouse.js +3 -3
- package/dist/runtime/utils/layout/menuBar.js +3 -3
- package/dist/runtime/utils/style/anchor.d.ts +1 -1
- package/dist/runtime/utils/style/anchor.js +24 -17
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -6,6 +6,6 @@ export declare function _editorMousemoveEvent(event: MouseEvent, store: Ref<Drag
|
|
|
6
6
|
export declare function _editorMouseupEvent(event: MouseEvent, store: Ref<DragonEditorStore>): void;
|
|
7
7
|
export declare function _editorMouseleaveEvent(event: MouseEvent, store: Ref<DragonEditorStore>): void;
|
|
8
8
|
export declare function _checkOthersideClick(event: MouseEvent, store: Ref<DragonEditorStore>): void;
|
|
9
|
-
export declare function _openAnchorArea(store: Ref<DragonEditorStore>): void;
|
|
9
|
+
export declare function _openAnchorArea(event: MouseEvent, store: Ref<DragonEditorStore>): void;
|
|
10
10
|
export declare function _decideWhetherOpenControlBar(store: Ref<DragonEditorStore>): void;
|
|
11
11
|
export declare function _editorContextMenuEvent(event: MouseEvent, store: Ref<DragonEditorStore>): void;
|
|
@@ -14,7 +14,7 @@ export function _editorMousemoveEvent(event, store) {
|
|
|
14
14
|
}
|
|
15
15
|
export function _editorMouseupEvent(event, store) {
|
|
16
16
|
_imageResizeEventEnd(event, store);
|
|
17
|
-
_updateAnchorTagValue(store);
|
|
17
|
+
_updateAnchorTagValue(event, store);
|
|
18
18
|
}
|
|
19
19
|
export function _editorMouseleaveEvent(event, store) {
|
|
20
20
|
_imageResizeEventEnd(event, store);
|
|
@@ -39,9 +39,9 @@ function __blockAddOthersideEvent(event, store) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
export function _openAnchorArea(store) {
|
|
42
|
+
export function _openAnchorArea(event, store) {
|
|
43
43
|
store.value.controlStatus.previousCorsorData = store.value.cursorData;
|
|
44
|
-
_updateAnchorTagValue(store, true);
|
|
44
|
+
_updateAnchorTagValue(event, store, true);
|
|
45
45
|
_updateHeadingBlockList(store);
|
|
46
46
|
if (store.value.controlStatus.anchorHref !== "" && store.value.controlStatus.anchorHref.charAt(0) === "#") {
|
|
47
47
|
store.value.controlStatus.anchorTabType = "heading";
|
|
@@ -35,7 +35,7 @@ export function _getMenuBarVNodeStructure(store) {
|
|
|
35
35
|
h("input", {
|
|
36
36
|
class: ["de-input", { "--error": store.value.controlStatus.anchorValidation === false }],
|
|
37
37
|
value: store.value.controlStatus.anchorHref,
|
|
38
|
-
|
|
38
|
+
onInput: (event) => {
|
|
39
39
|
store.value.controlStatus.anchorHref = event.currentTarget.value;
|
|
40
40
|
}
|
|
41
41
|
}),
|
|
@@ -146,8 +146,8 @@ function __getMenuListStructure(store) {
|
|
|
146
146
|
"button",
|
|
147
147
|
{
|
|
148
148
|
class: ["de-menu", "js-de-link-btn"],
|
|
149
|
-
onClick: () => {
|
|
150
|
-
_openAnchorArea(store);
|
|
149
|
+
onClick: (event) => {
|
|
150
|
+
_openAnchorArea(event, store);
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
[_getIconNode("add-link")]
|
|
@@ -2,4 +2,4 @@ import type { Ref } from "vue";
|
|
|
2
2
|
import type { DragonEditorStore } from "../../type.js";
|
|
3
3
|
export declare function _setAnchorTag(url: string, isOutsideLink: boolean, store: Ref<DragonEditorStore>): void;
|
|
4
4
|
export declare function _unsetAnchorTag(store: Ref<DragonEditorStore>): false | undefined;
|
|
5
|
-
export declare function _updateAnchorTagValue(store: Ref<DragonEditorStore>, previous?: boolean): void;
|
|
5
|
+
export declare function _updateAnchorTagValue(event: MouseEvent, store: Ref<DragonEditorStore>, previous?: boolean): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _setRangeCursor, _updateCursorData, _updateModelData, _sortingCursorDataOnElement } from "../event/index.js";
|
|
2
2
|
import { _findContentEditableElement, _findPoverTextNode } from "../node/index.js";
|
|
3
3
|
export function _setAnchorTag(url, isOutsideLink, store) {
|
|
4
|
+
console.log("url", url);
|
|
4
5
|
if (store.value.controlStatus.previousCorsorData !== null && store.value.controlStatus.$currentBlock !== null) {
|
|
5
6
|
const cursorData = store.value.controlStatus.previousCorsorData;
|
|
6
7
|
const typeIgnoreList = ["image", "code", "custom"];
|
|
@@ -215,25 +216,31 @@ export function _unsetAnchorTag(store) {
|
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
|
-
export function _updateAnchorTagValue(store, previous = false) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
$
|
|
219
|
+
export function _updateAnchorTagValue(event, store, previous = false) {
|
|
220
|
+
const $target = event.target;
|
|
221
|
+
if ($target !== null) {
|
|
222
|
+
const $linkArea = $target.closest(".js-de-link-exit-area");
|
|
223
|
+
if ($linkArea === null) {
|
|
224
|
+
if (store.value.controlStatus.previousCorsorData !== null && store.value.cursorData !== null) {
|
|
225
|
+
const cursorData = previous === true ? store.value.controlStatus.previousCorsorData : store.value.cursorData;
|
|
226
|
+
if (cursorData.type === "Caret" || cursorData.type === "Range" && cursorData.startNode === cursorData.endNode) {
|
|
227
|
+
const $element = _findContentEditableElement(cursorData.startNode);
|
|
228
|
+
let $targetNode = cursorData.startNode;
|
|
229
|
+
if ($targetNode.constructor.name === "Text") {
|
|
230
|
+
if ($targetNode.parentElement !== $element) {
|
|
231
|
+
$targetNode = $targetNode.parentElement;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if ($targetNode.constructor.name === "HTMLAnchorElement") {
|
|
235
|
+
const $tag = $targetNode;
|
|
236
|
+
store.value.controlStatus.anchorHref = $tag.href;
|
|
237
|
+
} else {
|
|
238
|
+
store.value.controlStatus.anchorHref = "";
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
store.value.controlStatus.anchorHref = "";
|
|
227
242
|
}
|
|
228
243
|
}
|
|
229
|
-
if ($targetNode.constructor.name === "HTMLAnchorElement") {
|
|
230
|
-
const $tag = $targetNode;
|
|
231
|
-
store.value.controlStatus.anchorHref = $tag.href;
|
|
232
|
-
} else {
|
|
233
|
-
store.value.controlStatus.anchorHref = "";
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
store.value.controlStatus.anchorHref = "";
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
}
|