vue-devui 1.6.4-alpha.0 → 1.6.4-markdown.0

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.
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { toRefs, onMounted, onUnmounted, watch, defineComponent, ref, renderSlot, useSlots, createVNode, reactive, computed, nextTick, onBeforeMount, onBeforeUnmount, Transition, mergeProps, unref, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow, createTextVNode, isVNode } from "vue";
24
+ import { toRefs, onMounted, onUnmounted, watch, defineComponent, ref, renderSlot, useSlots, createVNode, reactive, computed, nextTick, onBeforeUnmount, onBeforeMount, Transition, mergeProps, unref, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow, createTextVNode, isVNode } from "vue";
25
25
  import "clipboard";
26
26
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
27
27
  import { onClickOutside } from "@vueuse/core";
@@ -7275,6 +7275,7 @@ function useEditorMd(props, ctx) {
7275
7275
  const renderRef = ref();
7276
7276
  const overlayRef = ref();
7277
7277
  const cursorRef = ref();
7278
+ const containerRef = ref();
7278
7279
  const isHintShow = ref();
7279
7280
  const previewHtmlList = ref([]);
7280
7281
  let editorIns;
@@ -7502,12 +7503,22 @@ function useEditorMd(props, ctx) {
7502
7503
  }
7503
7504
  }
7504
7505
  };
7506
+ const onDocumentClick = (e) => {
7507
+ var _a;
7508
+ if (isHintShow.value && e.target !== containerRef.value && !((_a = containerRef.value) == null ? void 0 : _a.contains(e.target))) {
7509
+ hideHint();
7510
+ }
7511
+ };
7505
7512
  onMounted(async () => {
7506
7513
  await import("codemirror/addon/display/placeholder.js");
7507
7514
  await import("codemirror/mode/markdown/markdown.js");
7508
7515
  const module = await import("codemirror");
7509
7516
  CodeMirror = module.default;
7510
7517
  initEditor();
7518
+ document.addEventListener("click", onDocumentClick);
7519
+ });
7520
+ onBeforeUnmount(() => {
7521
+ document.removeEventListener("click", onDocumentClick);
7511
7522
  });
7512
7523
  watch(modelValue, (val) => {
7513
7524
  if (editorIns) {
@@ -7548,6 +7559,7 @@ function useEditorMd(props, ctx) {
7548
7559
  overlayRef,
7549
7560
  cursorRef,
7550
7561
  renderRef,
7562
+ containerRef,
7551
7563
  toolbars,
7552
7564
  previewHtmlList,
7553
7565
  isHintShow,
@@ -9237,6 +9249,7 @@ var EditorMd = defineComponent({
9237
9249
  overlayRef,
9238
9250
  cursorRef,
9239
9251
  renderRef,
9252
+ containerRef,
9240
9253
  isHintShow,
9241
9254
  toolbars,
9242
9255
  previewHtmlList,
@@ -9267,6 +9280,7 @@ var EditorMd = defineComponent({
9267
9280
  "z-index": fullscreenZIndex.value
9268
9281
  }, {
9269
9282
  default: () => [createVNode("div", {
9283
+ "ref": containerRef,
9270
9284
  "class": ["dp-md-container", {
9271
9285
  "dp-md-readonly": mode.value === "readonly",
9272
9286
  "dp-md-editonly": mode.value === "editonly",
@@ -9293,7 +9307,9 @@ var EditorMd = defineComponent({
9293
9307
  "onUpdate:modelValue": ($event) => isHintShow.value = $event,
9294
9308
  "origin": cursorRef.value || void 0,
9295
9309
  "align": "start",
9296
- "position": ["bottom-start"]
9310
+ "position": ["bottom-start"],
9311
+ "onClick": withModifiers(() => {
9312
+ }, ["stop"])
9297
9313
  }, {
9298
9314
  default: () => {
9299
9315
  var _a, _b;