md-editor-v3 4.13.0-beta.0 → 4.13.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.
package/README.md CHANGED
@@ -151,6 +151,7 @@ Except for the same as `MdPreview`:
151
151
  | completions | `Array<CompletionSource>` | [] | `@codemirror/autocomplete` List of function to match keywords |
152
152
  | showToolbarName | `boolean` | false | Show toolbar name or not |
153
153
  | inputBoxWitdh | `string` | '50%' | Default width of input box |
154
+ | transformImgUrl | `(imgUrl: string) => string` | t => t | Transform image links |
154
155
 
155
156
  <details>
156
157
  <summary>『toolbars』</summary>
@@ -21,6 +21,7 @@ const commands = require("@codemirror/commands");
21
21
  const language = require("@codemirror/language");
22
22
  const highlight = require("@lezer/highlight");
23
23
  const autocomplete = require("@codemirror/autocomplete");
24
+ const search = require("@codemirror/search");
24
25
  const MdPreview = require("./chunks/index.cjs");
25
26
  const MdCatalog = require("./MdCatalog.cjs");
26
27
  const vueTsx = require("./chunks/vue-tsx.cjs");
@@ -1779,8 +1780,8 @@ const oneDarkTheme = view.EditorView.theme(
1779
1780
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor$1 },
1780
1781
  "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection$1 },
1781
1782
  ".cm-panels": { backgroundColor: darkBackground$1, color: ivory$1 },
1782
- ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1783
- ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1783
+ ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1784
+ ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1784
1785
  ".cm-searchMatch": {
1785
1786
  backgroundColor: "#72a1ff59",
1786
1787
  outline: "1px solid #457dff"
@@ -1872,7 +1873,7 @@ const oneDark = [
1872
1873
  oneDarkTheme,
1873
1874
  language.syntaxHighlighting(oneDarkHighlightStyle)
1874
1875
  ];
1875
- const chalky = "#e5c07b", coral = "#3f4a54", cyan = "#56b6c2", invalid = "#fff", ivory = "#3f4a54", stone = "#2d8cf0", malibu = "#2d8cf0", sage = "#3f4a54", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#ceedfa33", background = "var(--md-bk-color)", tooltipBackground = "var(--md-bk-color)", selection = "#bad5fa", cursor = "#3f4a54";
1876
+ const chalky = "#e5c07b", coral = "#3f4a54", cyan = "#56b6c2", invalid = "#fff", ivory = "#3f4a54", stone = "#2d8cf0", malibu = "#2d8cf0", sage = "#3f4a54", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#f6f6f6", highlightBackground = "#ceedfa33", background = "var(--md-bk-color)", tooltipBackground = "var(--md-bk-color)", selection = "#bad5fa", cursor = "#3f4a54";
1876
1877
  const oneLightTheme = view.EditorView.theme(
1877
1878
  {
1878
1879
  "&": {
@@ -1885,8 +1886,8 @@ const oneLightTheme = view.EditorView.theme(
1885
1886
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
1886
1887
  "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
1887
1888
  ".cm-panels": { backgroundColor: darkBackground, color: ivory },
1888
- ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1889
- ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1889
+ ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1890
+ ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1890
1891
  ".cm-searchMatch": {
1891
1892
  backgroundColor: "#72a1ff59",
1892
1893
  outline: "1px solid #457dff"
@@ -2282,9 +2283,10 @@ class CodeMirrorUt {
2282
2283
  ]);
2283
2284
  }
2284
2285
  }
2285
- const usePasteUpload = (props2) => {
2286
+ const usePasteUpload = (props2, codeMirrorUt) => {
2286
2287
  const editorId = vue.inject("editorId");
2287
2288
  const pasteHandler = (e) => {
2289
+ var _a, _b, _c;
2288
2290
  if (!e.clipboardData) {
2289
2291
  return;
2290
2292
  }
@@ -2300,6 +2302,34 @@ const usePasteUpload = (props2) => {
2300
2302
  e.preventDefault();
2301
2303
  return;
2302
2304
  }
2305
+ const targetValue = e.clipboardData.getData("text/plain");
2306
+ const to = ((_a = codeMirrorUt.value) == null ? void 0 : _a.view.state.selection.main.to) || 0;
2307
+ const from = ((_b = codeMirrorUt.value) == null ? void 0 : _b.view.state.doc.lineAt(to).from) || 0;
2308
+ const lineStart = ((_c = codeMirrorUt.value) == null ? void 0 : _c.view.state.doc.sliceString(from, to)) || "";
2309
+ const templateStart = /!\[.*\]\(\s*$/.test(lineStart);
2310
+ const templateIn = /!\[.*\]\((.*)\s?.*\)/.test(targetValue);
2311
+ if (templateStart) {
2312
+ index.bus.emit(editorId, index.REPLACE, "universal", {
2313
+ generate() {
2314
+ return {
2315
+ targetValue: props2.transformImgUrl(targetValue)
2316
+ };
2317
+ }
2318
+ });
2319
+ e.preventDefault();
2320
+ return;
2321
+ } else if (templateIn) {
2322
+ const matchArr = targetValue.match(new RegExp(`(?<=!\\[.*\\]\\()\\S+(?=\\s?["']?.*["']?\\))`));
2323
+ index.bus.emit(editorId, index.REPLACE, "universal", {
2324
+ generate() {
2325
+ return {
2326
+ targetValue: matchArr ? targetValue.replace(matchArr[0], props2.transformImgUrl(matchArr[0])) : targetValue
2327
+ };
2328
+ }
2329
+ });
2330
+ e.preventDefault();
2331
+ return;
2332
+ }
2303
2333
  if (props2.autoDetectCode && e.clipboardData.types.includes("vscode-editor-data")) {
2304
2334
  const vscCoodInfo = JSON.parse(e.clipboardData.getData("vscode-editor-data"));
2305
2335
  index.bus.emit(editorId, index.REPLACE, "code", {
@@ -2309,7 +2339,6 @@ const usePasteUpload = (props2) => {
2309
2339
  e.preventDefault();
2310
2340
  return;
2311
2341
  }
2312
- const targetValue = e.clipboardData.getData("text/plain");
2313
2342
  if (props2.maxlength && targetValue.length + props2.modelValue.length > props2.maxlength) {
2314
2343
  index.bus.emit(editorId, index.ERROR_CATCHER, {
2315
2344
  name: "overlength",
@@ -2504,7 +2533,8 @@ const createCommands = (id, contentProps) => {
2504
2533
  CtrlC,
2505
2534
  CtrlL,
2506
2535
  CtrlF,
2507
- CtrlT
2536
+ CtrlT,
2537
+ ...search.searchKeymap
2508
2538
  ];
2509
2539
  };
2510
2540
  const useCodeMirror = (props2) => {
@@ -2516,7 +2546,7 @@ const useCodeMirror = (props2) => {
2516
2546
  const languageComp = new state.Compartment(), themeComp = new state.Compartment(), autocompletionComp = new state.Compartment(), historyComp = new state.Compartment(), eventComp = new state.Compartment();
2517
2547
  const mdEditorCommands = createCommands(editorId, props2);
2518
2548
  const spelling = vue.ref(false);
2519
- const pasteHandler = usePasteUpload(props2);
2549
+ const pasteHandler = usePasteUpload(props2, codeMirrorUt);
2520
2550
  const domEventHandlers = {
2521
2551
  paste: pasteHandler,
2522
2552
  blur: props2.onBlur,
@@ -3124,7 +3154,8 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
3124
3154
  }
3125
3155
  ctx.emit("onInputBoxWitdhChange", width);
3126
3156
  },
3127
- "sanitizeMermaid": props2.sanitizeMermaid
3157
+ "sanitizeMermaid": props2.sanitizeMermaid,
3158
+ "transformImgUrl": props2.transformImgUrl
3128
3159
  }, null), ((_a = props2.footers) == null ? void 0 : _a.length) > 0 && vue.createVNode(Footer, {
3129
3160
  "modelValue": props2.modelValue,
3130
3161
  "footers": props2.footers,
@@ -933,6 +933,10 @@ const contentProps = {
933
933
  },
934
934
  onInputBoxWitdhChange: {
935
935
  type: Function
936
+ },
937
+ transformImgUrl: {
938
+ type: Function,
939
+ default: (t) => t
936
940
  }
937
941
  };
938
942
  const ContentPreview = /* @__PURE__ */ vue.defineComponent({
@@ -1794,6 +1798,16 @@ const editorProps = {
1794
1798
  */
1795
1799
  onInputBoxWitdhChange: {
1796
1800
  type: Function
1801
+ },
1802
+ /**
1803
+ * 替换粘贴的图片链接
1804
+ *
1805
+ * @param t 图片链接
1806
+ * @returns
1807
+ */
1808
+ transformImgUrl: {
1809
+ type: Function,
1810
+ default: (t) => t
1797
1811
  }
1798
1812
  };
1799
1813
  const mdPreviewEmits = ["onHtmlChanged", "onGetCatalog"];
@@ -20,6 +20,7 @@ import { deleteLine, defaultKeymap, historyKeymap, indentWithTab, history, undo,
20
20
  import { HighlightStyle, syntaxHighlighting, indentUnit } from "@codemirror/language";
21
21
  import { tags } from "@lezer/highlight";
22
22
  import { autocompletion } from "@codemirror/autocomplete";
23
+ import { searchKeymap } from "@codemirror/search";
23
24
  import { c as contentProps, C as ContentPreview, e as editorProps, a as editorEmits, u as useOnSave, b as useProvide, d as useExpansion, f as useErrorCatcher, g as useConfig, h as useCatalog, i as useExpose, M as MdPreview } from "./chunks/index.mjs";
24
25
  import MdCatalog from "./MdCatalog.mjs";
25
26
  import { g as getSlot } from "./chunks/vue-tsx.mjs";
@@ -1778,8 +1779,8 @@ const oneDarkTheme = EditorView.theme(
1778
1779
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor$1 },
1779
1780
  "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection$1 },
1780
1781
  ".cm-panels": { backgroundColor: darkBackground$1, color: ivory$1 },
1781
- ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1782
- ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1782
+ ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1783
+ ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1783
1784
  ".cm-searchMatch": {
1784
1785
  backgroundColor: "#72a1ff59",
1785
1786
  outline: "1px solid #457dff"
@@ -1871,7 +1872,7 @@ const oneDark = [
1871
1872
  oneDarkTheme,
1872
1873
  syntaxHighlighting(oneDarkHighlightStyle)
1873
1874
  ];
1874
- const chalky = "#e5c07b", coral = "#3f4a54", cyan = "#56b6c2", invalid = "#fff", ivory = "#3f4a54", stone = "#2d8cf0", malibu = "#2d8cf0", sage = "#3f4a54", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#ceedfa33", background = "var(--md-bk-color)", tooltipBackground = "var(--md-bk-color)", selection = "#bad5fa", cursor = "#3f4a54";
1875
+ const chalky = "#e5c07b", coral = "#3f4a54", cyan = "#56b6c2", invalid = "#fff", ivory = "#3f4a54", stone = "#2d8cf0", malibu = "#2d8cf0", sage = "#3f4a54", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#f6f6f6", highlightBackground = "#ceedfa33", background = "var(--md-bk-color)", tooltipBackground = "var(--md-bk-color)", selection = "#bad5fa", cursor = "#3f4a54";
1875
1876
  const oneLightTheme = EditorView.theme(
1876
1877
  {
1877
1878
  "&": {
@@ -1884,8 +1885,8 @@ const oneLightTheme = EditorView.theme(
1884
1885
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
1885
1886
  "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
1886
1887
  ".cm-panels": { backgroundColor: darkBackground, color: ivory },
1887
- ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1888
- ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1888
+ ".cm-panels.cm-panels-top": { borderBottom: "1px solid var(--md-border-color)" },
1889
+ ".cm-panels.cm-panels-bottom": { borderTop: "1px solid var(--md-border-color)" },
1889
1890
  ".cm-searchMatch": {
1890
1891
  backgroundColor: "#72a1ff59",
1891
1892
  outline: "1px solid #457dff"
@@ -2281,9 +2282,10 @@ class CodeMirrorUt {
2281
2282
  ]);
2282
2283
  }
2283
2284
  }
2284
- const usePasteUpload = (props2) => {
2285
+ const usePasteUpload = (props2, codeMirrorUt) => {
2285
2286
  const editorId = inject("editorId");
2286
2287
  const pasteHandler = (e) => {
2288
+ var _a, _b, _c;
2287
2289
  if (!e.clipboardData) {
2288
2290
  return;
2289
2291
  }
@@ -2299,6 +2301,34 @@ const usePasteUpload = (props2) => {
2299
2301
  e.preventDefault();
2300
2302
  return;
2301
2303
  }
2304
+ const targetValue = e.clipboardData.getData("text/plain");
2305
+ const to = ((_a = codeMirrorUt.value) == null ? void 0 : _a.view.state.selection.main.to) || 0;
2306
+ const from = ((_b = codeMirrorUt.value) == null ? void 0 : _b.view.state.doc.lineAt(to).from) || 0;
2307
+ const lineStart = ((_c = codeMirrorUt.value) == null ? void 0 : _c.view.state.doc.sliceString(from, to)) || "";
2308
+ const templateStart = /!\[.*\]\(\s*$/.test(lineStart);
2309
+ const templateIn = /!\[.*\]\((.*)\s?.*\)/.test(targetValue);
2310
+ if (templateStart) {
2311
+ bus.emit(editorId, REPLACE, "universal", {
2312
+ generate() {
2313
+ return {
2314
+ targetValue: props2.transformImgUrl(targetValue)
2315
+ };
2316
+ }
2317
+ });
2318
+ e.preventDefault();
2319
+ return;
2320
+ } else if (templateIn) {
2321
+ const matchArr = targetValue.match(new RegExp(`(?<=!\\[.*\\]\\()\\S+(?=\\s?["']?.*["']?\\))`));
2322
+ bus.emit(editorId, REPLACE, "universal", {
2323
+ generate() {
2324
+ return {
2325
+ targetValue: matchArr ? targetValue.replace(matchArr[0], props2.transformImgUrl(matchArr[0])) : targetValue
2326
+ };
2327
+ }
2328
+ });
2329
+ e.preventDefault();
2330
+ return;
2331
+ }
2302
2332
  if (props2.autoDetectCode && e.clipboardData.types.includes("vscode-editor-data")) {
2303
2333
  const vscCoodInfo = JSON.parse(e.clipboardData.getData("vscode-editor-data"));
2304
2334
  bus.emit(editorId, REPLACE, "code", {
@@ -2308,7 +2338,6 @@ const usePasteUpload = (props2) => {
2308
2338
  e.preventDefault();
2309
2339
  return;
2310
2340
  }
2311
- const targetValue = e.clipboardData.getData("text/plain");
2312
2341
  if (props2.maxlength && targetValue.length + props2.modelValue.length > props2.maxlength) {
2313
2342
  bus.emit(editorId, ERROR_CATCHER, {
2314
2343
  name: "overlength",
@@ -2503,7 +2532,8 @@ const createCommands = (id, contentProps2) => {
2503
2532
  CtrlC,
2504
2533
  CtrlL,
2505
2534
  CtrlF,
2506
- CtrlT
2535
+ CtrlT,
2536
+ ...searchKeymap
2507
2537
  ];
2508
2538
  };
2509
2539
  const useCodeMirror = (props2) => {
@@ -2515,7 +2545,7 @@ const useCodeMirror = (props2) => {
2515
2545
  const languageComp = new Compartment(), themeComp = new Compartment(), autocompletionComp = new Compartment(), historyComp = new Compartment(), eventComp = new Compartment();
2516
2546
  const mdEditorCommands = createCommands(editorId, props2);
2517
2547
  const spelling = ref(false);
2518
- const pasteHandler = usePasteUpload(props2);
2548
+ const pasteHandler = usePasteUpload(props2, codeMirrorUt);
2519
2549
  const domEventHandlers = {
2520
2550
  paste: pasteHandler,
2521
2551
  blur: props2.onBlur,
@@ -3123,7 +3153,8 @@ const Editor = /* @__PURE__ */ defineComponent({
3123
3153
  }
3124
3154
  ctx.emit("onInputBoxWitdhChange", width);
3125
3155
  },
3126
- "sanitizeMermaid": props2.sanitizeMermaid
3156
+ "sanitizeMermaid": props2.sanitizeMermaid,
3157
+ "transformImgUrl": props2.transformImgUrl
3127
3158
  }, null), ((_a = props2.footers) == null ? void 0 : _a.length) > 0 && createVNode(Footer, {
3128
3159
  "modelValue": props2.modelValue,
3129
3160
  "footers": props2.footers,
@@ -932,6 +932,10 @@ const contentProps = {
932
932
  },
933
933
  onInputBoxWitdhChange: {
934
934
  type: Function
935
+ },
936
+ transformImgUrl: {
937
+ type: Function,
938
+ default: (t) => t
935
939
  }
936
940
  };
937
941
  const ContentPreview = /* @__PURE__ */ defineComponent({
@@ -1793,6 +1797,16 @@ const editorProps = {
1793
1797
  */
1794
1798
  onInputBoxWitdhChange: {
1795
1799
  type: Function
1800
+ },
1801
+ /**
1802
+ * 替换粘贴的图片链接
1803
+ *
1804
+ * @param t 图片链接
1805
+ * @returns
1806
+ */
1807
+ transformImgUrl: {
1808
+ type: Function,
1809
+ default: (t) => t
1796
1810
  }
1797
1811
  };
1798
1812
  const mdPreviewEmits = ["onHtmlChanged", "onGetCatalog"];
package/lib/style.css CHANGED
@@ -381,6 +381,64 @@
381
381
  }.ͼ1 .cm-scroller {
382
382
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
383
383
  line-height: 20px;
384
+ }.cm-search .cm-textfield {
385
+ border-radius: 4px;
386
+ padding: 4px 11px;
387
+ color: var(--md-color);
388
+ font-size: 10px;
389
+ background-image: none;
390
+ border: 1px solid var(--md-border-color);
391
+ transition: all 0.2s;
392
+ }.cm-search .cm-textfield:focus,
393
+ .cm-search .cm-textfield:hover {
394
+ border-color: var(--md-border-hover-color);
395
+ outline: 0;
396
+ }.cm-search .cm-textfield:focus {
397
+ border-color: var(--md-border-active-color);
398
+ }.cm-search .cm-button {
399
+ font-weight: 400;
400
+ text-align: center;
401
+ vertical-align: middle;
402
+ cursor: pointer;
403
+ border: 1px solid var(--md-border-color);
404
+ white-space: nowrap;
405
+ user-select: none;
406
+ height: 20px;
407
+ padding: 0 15px;
408
+ font-size: 10px;
409
+ border-radius: 4px;
410
+ transition: all 0.2s linear;
411
+ color: var(--md-color);
412
+ background-color: inherit;
413
+ background-image: none;
414
+ border-color: var(--md-border-color);
415
+ }.cm-search .cm-button:first-of-type {
416
+ margin-left: 0;
417
+ }.cm-search .cm-button:hover {
418
+ color: var(--md-hover-color);
419
+ background-color: inherit;
420
+ border-color: var(--md-border-hover-color);
421
+ }.cm-search input[type='checkbox'] {
422
+ vertical-align: sub;
423
+ }.cm-search input[type='checkbox']::after {
424
+ display: block;
425
+ content: '';
426
+ font-weight: bold;
427
+ cursor: pointer;
428
+ width: 12px;
429
+ height: 12px;
430
+ border: 1px solid var(--md-border-color);
431
+ background-color: var(--md-bk-color-outstand);
432
+ border-radius: 2px;
433
+ line-height: 1;
434
+ text-align: center;
435
+ }.cm-search input[type='checkbox']:checked::after {
436
+ content: '✓';
437
+ color: var(--md-color);
438
+ }.cm-search button[name='close'] {
439
+ color: inherit;
440
+ cursor: pointer;
441
+ right: 6px;
384
442
  }.md-editor-catalog-editor {
385
443
  --md-color: #3f4a54;
386
444
  --md-hover-color: #000;
@@ -105,6 +105,10 @@ declare const Editor: import('vue').DefineComponent<{
105
105
  onInputBoxWitdhChange: {
106
106
  type: import("vue").PropType<(width: string) => void>;
107
107
  };
108
+ transformImgUrl: {
109
+ type: import("vue").PropType<(t: string) => string>;
110
+ default: (t: string) => string;
111
+ };
108
112
  modelValue: {
109
113
  type: import("vue").PropType<string>;
110
114
  default: string;
@@ -301,6 +305,10 @@ declare const Editor: import('vue').DefineComponent<{
301
305
  onInputBoxWitdhChange: {
302
306
  type: import("vue").PropType<(width: string) => void>;
303
307
  };
308
+ transformImgUrl: {
309
+ type: import("vue").PropType<(t: string) => string>;
310
+ default: (t: string) => string;
311
+ };
304
312
  modelValue: {
305
313
  type: import("vue").PropType<string>;
306
314
  default: string;
@@ -420,6 +428,7 @@ declare const Editor: import('vue').DefineComponent<{
420
428
  scrollAuto: boolean;
421
429
  showToolbarName: boolean;
422
430
  inputBoxWitdh: string;
431
+ transformImgUrl: (t: string) => string;
423
432
  modelValue: string;
424
433
  theme: import("~/type").Themes;
425
434
  editorId: string;
@@ -21,6 +21,7 @@ declare const _default: {
21
21
  scrollAuto: boolean;
22
22
  showToolbarName: boolean;
23
23
  inputBoxWitdh: string;
24
+ transformImgUrl: (t: string) => string;
24
25
  modelValue: string;
25
26
  theme: import('./type').Themes;
26
27
  editorId: string;
@@ -145,6 +146,10 @@ declare const _default: {
145
146
  onInputBoxWitdhChange: {
146
147
  type: import("vue").PropType<(width: string) => void>;
147
148
  };
149
+ transformImgUrl: {
150
+ type: import("vue").PropType<(t: string) => string>;
151
+ default: (t: string) => string;
152
+ };
148
153
  modelValue: {
149
154
  type: import("vue").PropType<string>;
150
155
  default: string;
@@ -247,7 +252,7 @@ declare const _default: {
247
252
  onOnInput?: ((...args: any[]) => any) | undefined;
248
253
  onOnDrop?: ((...args: any[]) => any) | undefined;
249
254
  onOnInputBoxWitdhChange?: ((...args: any[]) => any) | undefined;
250
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "preview" | "pageFullscreen" | "htmlPreview" | "class" | "style" | "language" | "toolbars" | "toolbarsExclude" | "noPrettier" | "tabWidth" | "tableShape" | "placeholder" | "footers" | "scrollAuto" | "showToolbarName" | "inputBoxWitdh" | "modelValue" | "theme" | "editorId" | "showCodeRowNumber" | "previewTheme" | "mdHeadingId" | "sanitize" | "noMermaid" | "noKatex" | "codeTheme" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "noHighlight" | "noImgZoomIn" | "customIcon" | "sanitizeMermaid">;
255
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "preview" | "pageFullscreen" | "htmlPreview" | "class" | "style" | "language" | "toolbars" | "toolbarsExclude" | "noPrettier" | "tabWidth" | "tableShape" | "placeholder" | "footers" | "scrollAuto" | "showToolbarName" | "inputBoxWitdh" | "transformImgUrl" | "modelValue" | "theme" | "editorId" | "showCodeRowNumber" | "previewTheme" | "mdHeadingId" | "sanitize" | "noMermaid" | "noKatex" | "codeTheme" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "noHighlight" | "noImgZoomIn" | "customIcon" | "sanitizeMermaid">;
251
256
  $attrs: {
252
257
  [x: string]: unknown;
253
258
  };
@@ -368,6 +373,10 @@ declare const _default: {
368
373
  onInputBoxWitdhChange: {
369
374
  type: import("vue").PropType<(width: string) => void>;
370
375
  };
376
+ transformImgUrl: {
377
+ type: import("vue").PropType<(t: string) => string>;
378
+ default: (t: string) => string;
379
+ };
371
380
  modelValue: {
372
381
  type: import("vue").PropType<string>;
373
382
  default: string;
@@ -487,6 +496,7 @@ declare const _default: {
487
496
  scrollAuto: boolean;
488
497
  showToolbarName: boolean;
489
498
  inputBoxWitdh: string;
499
+ transformImgUrl: (t: string) => string;
490
500
  modelValue: string;
491
501
  theme: import("./type").Themes;
492
502
  editorId: string;
@@ -631,6 +641,10 @@ declare const _default: {
631
641
  onInputBoxWitdhChange: {
632
642
  type: import("vue").PropType<(width: string) => void>;
633
643
  };
644
+ transformImgUrl: {
645
+ type: import("vue").PropType<(t: string) => string>;
646
+ default: (t: string) => string;
647
+ };
634
648
  modelValue: {
635
649
  type: import("vue").PropType<string>;
636
650
  default: string;
@@ -844,6 +858,10 @@ declare const _default: {
844
858
  onInputBoxWitdhChange: {
845
859
  type: import("vue").PropType<(width: string) => void>;
846
860
  };
861
+ transformImgUrl: {
862
+ type: import("vue").PropType<(t: string) => string>;
863
+ default: (t: string) => string;
864
+ };
847
865
  modelValue: {
848
866
  type: import("vue").PropType<string>;
849
867
  default: string;
@@ -963,6 +981,7 @@ declare const _default: {
963
981
  scrollAuto: boolean;
964
982
  showToolbarName: boolean;
965
983
  inputBoxWitdh: string;
984
+ transformImgUrl: (t: string) => string;
966
985
  modelValue: string;
967
986
  theme: import("./type").Themes;
968
987
  editorId: string;
@@ -1,7 +1,9 @@
1
+ import { default as CodeMirrorUt } from '../codemirror';
1
2
  import { ContentProps } from '../props';
3
+ import { ShallowRef } from 'vue';
2
4
 
3
5
  /**
4
6
  * 处理粘贴板
5
7
  */
6
- declare const usePasteUpload: (props: ContentProps) => (e: ClipboardEvent) => void;
8
+ declare const usePasteUpload: (props: ContentProps, codeMirrorUt: ShallowRef<CodeMirrorUt | undefined>) => (e: ClipboardEvent) => void;
7
9
  export default usePasteUpload;
@@ -63,6 +63,10 @@ declare const _default: import('vue').DefineComponent<{
63
63
  onInputBoxWitdhChange: {
64
64
  type: import("vue").PropType<(width: string) => void>;
65
65
  };
66
+ transformImgUrl: {
67
+ type: import("vue").PropType<(t: string) => string>;
68
+ default: (t: string) => string;
69
+ };
66
70
  modelValue: {
67
71
  type: import("vue").PropType<string>;
68
72
  default: string;
@@ -180,6 +184,10 @@ declare const _default: import('vue').DefineComponent<{
180
184
  onInputBoxWitdhChange: {
181
185
  type: import("vue").PropType<(width: string) => void>;
182
186
  };
187
+ transformImgUrl: {
188
+ type: import("vue").PropType<(t: string) => string>;
189
+ default: (t: string) => string;
190
+ };
183
191
  modelValue: {
184
192
  type: import("vue").PropType<string>;
185
193
  default: string;
@@ -241,6 +249,7 @@ declare const _default: import('vue').DefineComponent<{
241
249
  onFocus: (event: FocusEvent) => void;
242
250
  onDrop: (event: DragEvent) => void;
243
251
  placeholder: string;
252
+ transformImgUrl: (t: string) => string;
244
253
  modelValue: string;
245
254
  theme: import("~/type").Themes;
246
255
  mdHeadingId: import("~/type").MdHeadingId;
@@ -128,6 +128,10 @@ export declare const contentProps: {
128
128
  onInputBoxWitdhChange: {
129
129
  type: PropType<(width: string) => void>;
130
130
  };
131
+ transformImgUrl: {
132
+ type: PropType<(t: string) => string>;
133
+ default: (t: string) => string;
134
+ };
131
135
  modelValue: {
132
136
  type: PropType<string>;
133
137
  default: string;
@@ -439,6 +439,16 @@ export declare const editorProps: {
439
439
  onInputBoxWitdhChange: {
440
440
  type: PropType<(width: string) => void>;
441
441
  };
442
+ /**
443
+ * 替换粘贴的图片链接
444
+ *
445
+ * @param t 图片链接
446
+ * @returns
447
+ */
448
+ transformImgUrl: {
449
+ type: PropType<(t: string) => string>;
450
+ default: (t: string) => string;
451
+ };
442
452
  /**
443
453
  * markdown content.
444
454
  *