mardora 1.2.0 → 1.2.2
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/{chunk-3OCUX4OO.js → chunk-SMHHXYOS.js} +53 -15
- package/dist/chunk-SMHHXYOS.js.map +1 -0
- package/dist/{chunk-7JOEPNEV.cjs → chunk-U3D2P2CM.cjs} +53 -14
- package/dist/chunk-U3D2P2CM.cjs.map +1 -0
- package/dist/index.cjs +41 -37
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins/index.cjs +28 -24
- package/dist/plugins/index.d.cts +2 -1
- package/dist/plugins/index.d.ts +2 -1
- package/dist/plugins/index.js +1 -1
- package/package.json +1 -1
- package/src/editor/media-lightbox.ts +1 -1
- package/src/plugins/code-plugin.theme.ts +2 -3
- package/src/plugins/code-plugin.ts +2 -0
- package/src/plugins/image-plugin.ts +50 -7
- package/src/plugins/index.ts +1 -1
- package/dist/chunk-3OCUX4OO.js.map +0 -1
- package/dist/chunk-7JOEPNEV.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,117 +1,109 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var chunk7JOEPNEV_cjs = require('./chunk-7JOEPNEV.cjs');
|
|
3
|
+
var chunkU3D2P2CM_cjs = require('./chunk-U3D2P2CM.cjs');
|
|
5
4
|
var chunkMLBEBFHB_cjs = require('./chunk-MLBEBFHB.cjs');
|
|
6
5
|
var chunkKNDWF2DP_cjs = require('./chunk-KNDWF2DP.cjs');
|
|
6
|
+
var chunk3ZOCCFDL_cjs = require('./chunk-3ZOCCFDL.cjs');
|
|
7
7
|
var chunkSWFUKJDO_cjs = require('./chunk-SWFUKJDO.cjs');
|
|
8
8
|
var chunkWFVCG4LD_cjs = require('./chunk-WFVCG4LD.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
Object.defineProperty(exports, "extractPreviewTocFromMarkdown", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunk3ZOCCFDL_cjs.extractPreviewTocFromMarkdown; }
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "generateCSS", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return chunk3ZOCCFDL_cjs.generateCSS; }
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "preview", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return chunk3ZOCCFDL_cjs.preview; }
|
|
23
|
-
});
|
|
24
12
|
Object.defineProperty(exports, "CODE_COPY_SUCCESS_ICON", {
|
|
25
13
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkU3D2P2CM_cjs.CODE_COPY_SUCCESS_ICON; }
|
|
27
15
|
});
|
|
28
16
|
Object.defineProperty(exports, "CodePlugin", {
|
|
29
17
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkU3D2P2CM_cjs.CodePlugin; }
|
|
31
19
|
});
|
|
32
20
|
Object.defineProperty(exports, "EmojiPlugin", {
|
|
33
21
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkU3D2P2CM_cjs.EmojiPlugin; }
|
|
35
23
|
});
|
|
36
24
|
Object.defineProperty(exports, "HRPlugin", {
|
|
37
25
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkU3D2P2CM_cjs.HRPlugin; }
|
|
39
27
|
});
|
|
40
28
|
Object.defineProperty(exports, "HTMLPlugin", {
|
|
41
29
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkU3D2P2CM_cjs.HTMLPlugin; }
|
|
43
31
|
});
|
|
44
32
|
Object.defineProperty(exports, "HeadingPlugin", {
|
|
45
33
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkU3D2P2CM_cjs.HeadingPlugin; }
|
|
47
35
|
});
|
|
48
36
|
Object.defineProperty(exports, "ImagePlugin", {
|
|
49
37
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkU3D2P2CM_cjs.ImagePlugin; }
|
|
51
39
|
});
|
|
52
40
|
Object.defineProperty(exports, "InlinePlugin", {
|
|
53
41
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkU3D2P2CM_cjs.InlinePlugin; }
|
|
55
43
|
});
|
|
56
44
|
Object.defineProperty(exports, "LinkPlugin", {
|
|
57
45
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkU3D2P2CM_cjs.LinkPlugin; }
|
|
59
47
|
});
|
|
60
48
|
Object.defineProperty(exports, "ListPlugin", {
|
|
61
49
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkU3D2P2CM_cjs.ListPlugin; }
|
|
63
51
|
});
|
|
64
52
|
Object.defineProperty(exports, "MathPlugin", {
|
|
65
53
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkU3D2P2CM_cjs.MathPlugin; }
|
|
67
55
|
});
|
|
68
56
|
Object.defineProperty(exports, "MermaidPlugin", {
|
|
69
57
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkU3D2P2CM_cjs.MermaidPlugin; }
|
|
71
59
|
});
|
|
72
60
|
Object.defineProperty(exports, "ParagraphPlugin", {
|
|
73
61
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkU3D2P2CM_cjs.ParagraphPlugin; }
|
|
75
63
|
});
|
|
76
64
|
Object.defineProperty(exports, "QuotePlugin", {
|
|
77
65
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkU3D2P2CM_cjs.QuotePlugin; }
|
|
79
67
|
});
|
|
80
68
|
Object.defineProperty(exports, "TablePlugin", {
|
|
81
69
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkU3D2P2CM_cjs.TablePlugin; }
|
|
83
71
|
});
|
|
84
72
|
Object.defineProperty(exports, "allPlugins", {
|
|
85
73
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkU3D2P2CM_cjs.allPlugins; }
|
|
87
75
|
});
|
|
88
76
|
Object.defineProperty(exports, "bindCodeCopyButtons", {
|
|
89
77
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkU3D2P2CM_cjs.bindCodeCopyButtons; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "bindImagePreviewButtons", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return chunkU3D2P2CM_cjs.bindImagePreviewButtons; }
|
|
91
83
|
});
|
|
92
84
|
Object.defineProperty(exports, "copyCodeTextToClipboard", {
|
|
93
85
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkU3D2P2CM_cjs.copyCodeTextToClipboard; }
|
|
95
87
|
});
|
|
96
88
|
Object.defineProperty(exports, "decodeCodeCopyPayload", {
|
|
97
89
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkU3D2P2CM_cjs.decodeCodeCopyPayload; }
|
|
99
91
|
});
|
|
100
92
|
Object.defineProperty(exports, "encodeCodeCopyPayload", {
|
|
101
93
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkU3D2P2CM_cjs.encodeCodeCopyPayload; }
|
|
103
95
|
});
|
|
104
96
|
Object.defineProperty(exports, "essentialPlugins", {
|
|
105
97
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkU3D2P2CM_cjs.essentialPlugins; }
|
|
107
99
|
});
|
|
108
100
|
Object.defineProperty(exports, "resolveCalloutTitleInputTarget", {
|
|
109
101
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkU3D2P2CM_cjs.resolveCalloutTitleInputTarget; }
|
|
111
103
|
});
|
|
112
104
|
Object.defineProperty(exports, "resolveCalloutTypeChange", {
|
|
113
105
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkU3D2P2CM_cjs.resolveCalloutTypeChange; }
|
|
115
107
|
});
|
|
116
108
|
Object.defineProperty(exports, "Compartment", {
|
|
117
109
|
enumerable: true,
|
|
@@ -305,6 +297,18 @@ Object.defineProperty(exports, "createWrapSelectionInputHandler", {
|
|
|
305
297
|
enumerable: true,
|
|
306
298
|
get: function () { return chunkKNDWF2DP_cjs.createWrapSelectionInputHandler; }
|
|
307
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "extractPreviewTocFromMarkdown", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () { return chunk3ZOCCFDL_cjs.extractPreviewTocFromMarkdown; }
|
|
303
|
+
});
|
|
304
|
+
Object.defineProperty(exports, "generateCSS", {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function () { return chunk3ZOCCFDL_cjs.generateCSS; }
|
|
307
|
+
});
|
|
308
|
+
Object.defineProperty(exports, "preview", {
|
|
309
|
+
enumerable: true,
|
|
310
|
+
get: function () { return chunk3ZOCCFDL_cjs.preview; }
|
|
311
|
+
});
|
|
308
312
|
Object.defineProperty(exports, "PreviewRenderer", {
|
|
309
313
|
enumerable: true,
|
|
310
314
|
get: function () { return chunkSWFUKJDO_cjs.PreviewRenderer; }
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ export { ChangeSpec, Compartment, EditorSelection, EditorState, Extension, Selec
|
|
|
2
2
|
export { EditorView, KeyBinding, ViewUpdate, highlightActiveLine, keymap } from '@codemirror/view';
|
|
3
3
|
export { D as DecorationContext, a as DecorationPlugin, I as InlineFormatInput, L as LinkChangeInput, M as MardoraAttachmentAccept, b as MardoraAttachmentKind, c as MardoraAttachmentUploadContext, d as MardoraAttachmentUploadResult, e as MardoraAttachmentUploadSource, f as MardoraAttachmentUploader, g as MardoraAttachmentsConfig, h as MardoraConfig, i as MardoraFileLike, j as MardoraHeadingFoldConfig, k as MardoraHeadingFoldLevel, l as MardoraHeadingFoldRange, m as MardoraI18nConfig, n as MardoraIconName, o as MardoraLocale, p as MardoraNode, q as MardoraPlugin, r as MardoraSelectionToolbarConfig, s as MardoraSlashCommand, t as MardoraSlashCommandContext, u as MardoraSlashCommandGroup, v as MardoraSlashCommandsConfig, w as MardoraSlashMessages, x as MardoraSlashQuery, y as MardoraTocConfig, z as MardoraTocItem, A as MardoraTocLevel, P as ParsedSelectionLink, B as PluginConfig, C as PluginContext, R as ResolvedMardoraHeadingFoldConfig, E as ResolvedMardoraTocConfig, S as SelectionToolbarActionId, F as SelectionToolbarAnchorRect, G as SelectionToolbarBlockType, H as SelectionToolbarBoundary, J as SelectionToolbarButton, K as SelectionToolbarFloatingSize, N as SelectionToolbarLayout, O as SelectionToolbarLayoutInput, Q as SelectionToolbarLinkState, T as SelectionToolbarListKind, U as SelectionToolbarMenuCallbacks, V as SelectionToolbarMenuState, W as SelectionToolbarMessages, X as SelectionToolbarPaletteItem, Y as SelectionToolbarPanel, Z as SelectionToolbarPlacement, _ as SelectionToolbarViewport, $ as SyntaxPlugin, a0 as TextChange, a1 as TextCommandResult, a2 as TextSelection, a3 as ThemeEnum, a4 as ThemeStyle, a5 as TocPanelState, a6 as TocStorageAdapter, a7 as createMardoraIcon, a8 as createTheme, a9 as cursorInRange, aa as deepMerge, ab as defaultMardoraLocale, ac as fixSelector, ad as flattenThemeStyles, ae as getSelectionToolbarMessages, af as hasMardoraIcon, ag as mardora, ah as resolveMardoraLocale, ai as selectionOverlapsRange, aj as toggleMarkdownStyle } from './mardora-DCwjomil.cjs';
|
|
4
4
|
export { MardoraAttachmentEditorView, MardoraSlashMenuCallbacks, MardoraSlashMenuState, MardoraSlashReplacement, MardoraSlashReplacementTemplate, MardoraSlashRuntimeConfig, MardoraUploadAttachmentOptions, MardoraUploadMarkerInput, MardoraUploadMarkerState, ResolvedMardoraSlashRuntimeConfig, TocPanelCallbacks, TocPanelRenderState, attachments, buildBlockTypeChange, buildInlineFormatChange, buildLinkChange, buildListChange, buildSlashReplacement, clampTocWidth, computeSelectionToolbarLayout, createSelectionToolbarElement, createSlashMenuElement, createSlashRuntimeConfig, createTocPanelElement, createTocSlugger, createUploadMarker, defaultSlashCommands, detectAttachmentKind, detectSelectionBlockType, detectSlashQuery, extractHeadingFoldRangesFromState, extractTocItemsFromState, filterSlashCommands, formatAttachmentMarkdown, getDefaultSlashCommands, getSlashMessages, headingFold, headingFoldTheme, isAcceptedAttachment, mardoraBaseTheme, markdownResetExtension, parseSelectedLink, readTocPanelState, resolveHeadingFoldConfig, resolveTocConfig, selectionToolbar, selectionToolbarTheme, slashCommands, slashMenuTheme, stripMarkdownHeadingText, tableOfContents, tocTheme, uploadAttachmentFile, writeTocPanelState } from './editor/index.cjs';
|
|
5
|
-
export { CODE_COPY_SUCCESS_ICON, CalloutLabel, CalloutTitleInputTarget, CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './plugins/index.cjs';
|
|
5
|
+
export { CODE_COPY_SUCCESS_ICON, CalloutLabel, CalloutTitleInputTarget, CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './plugins/index.cjs';
|
|
6
6
|
export { PreviewRenderer, defaultRenderers, escapeHtml, extractPreviewTocFromMarkdown, generateCSS, generateSyntaxThemeCSS, preview } from './preview/index.cjs';
|
|
7
7
|
export { G as GenerateCSSConfig, N as NodeRenderer, a as NodeRendererMap, P as PreviewConfig, b as PreviewContext, S as SyntaxThemeInput } from './types-NBsaxl4d.cjs';
|
|
8
8
|
export { WrapSelectionMarkerMap, createWrapSelectionInputHandler } from './lib/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { ChangeSpec, Compartment, EditorSelection, EditorState, Extension, Selec
|
|
|
2
2
|
export { EditorView, KeyBinding, ViewUpdate, highlightActiveLine, keymap } from '@codemirror/view';
|
|
3
3
|
export { D as DecorationContext, a as DecorationPlugin, I as InlineFormatInput, L as LinkChangeInput, M as MardoraAttachmentAccept, b as MardoraAttachmentKind, c as MardoraAttachmentUploadContext, d as MardoraAttachmentUploadResult, e as MardoraAttachmentUploadSource, f as MardoraAttachmentUploader, g as MardoraAttachmentsConfig, h as MardoraConfig, i as MardoraFileLike, j as MardoraHeadingFoldConfig, k as MardoraHeadingFoldLevel, l as MardoraHeadingFoldRange, m as MardoraI18nConfig, n as MardoraIconName, o as MardoraLocale, p as MardoraNode, q as MardoraPlugin, r as MardoraSelectionToolbarConfig, s as MardoraSlashCommand, t as MardoraSlashCommandContext, u as MardoraSlashCommandGroup, v as MardoraSlashCommandsConfig, w as MardoraSlashMessages, x as MardoraSlashQuery, y as MardoraTocConfig, z as MardoraTocItem, A as MardoraTocLevel, P as ParsedSelectionLink, B as PluginConfig, C as PluginContext, R as ResolvedMardoraHeadingFoldConfig, E as ResolvedMardoraTocConfig, S as SelectionToolbarActionId, F as SelectionToolbarAnchorRect, G as SelectionToolbarBlockType, H as SelectionToolbarBoundary, J as SelectionToolbarButton, K as SelectionToolbarFloatingSize, N as SelectionToolbarLayout, O as SelectionToolbarLayoutInput, Q as SelectionToolbarLinkState, T as SelectionToolbarListKind, U as SelectionToolbarMenuCallbacks, V as SelectionToolbarMenuState, W as SelectionToolbarMessages, X as SelectionToolbarPaletteItem, Y as SelectionToolbarPanel, Z as SelectionToolbarPlacement, _ as SelectionToolbarViewport, $ as SyntaxPlugin, a0 as TextChange, a1 as TextCommandResult, a2 as TextSelection, a3 as ThemeEnum, a4 as ThemeStyle, a5 as TocPanelState, a6 as TocStorageAdapter, a7 as createMardoraIcon, a8 as createTheme, a9 as cursorInRange, aa as deepMerge, ab as defaultMardoraLocale, ac as fixSelector, ad as flattenThemeStyles, ae as getSelectionToolbarMessages, af as hasMardoraIcon, ag as mardora, ah as resolveMardoraLocale, ai as selectionOverlapsRange, aj as toggleMarkdownStyle } from './mardora-DCwjomil.js';
|
|
4
4
|
export { MardoraAttachmentEditorView, MardoraSlashMenuCallbacks, MardoraSlashMenuState, MardoraSlashReplacement, MardoraSlashReplacementTemplate, MardoraSlashRuntimeConfig, MardoraUploadAttachmentOptions, MardoraUploadMarkerInput, MardoraUploadMarkerState, ResolvedMardoraSlashRuntimeConfig, TocPanelCallbacks, TocPanelRenderState, attachments, buildBlockTypeChange, buildInlineFormatChange, buildLinkChange, buildListChange, buildSlashReplacement, clampTocWidth, computeSelectionToolbarLayout, createSelectionToolbarElement, createSlashMenuElement, createSlashRuntimeConfig, createTocPanelElement, createTocSlugger, createUploadMarker, defaultSlashCommands, detectAttachmentKind, detectSelectionBlockType, detectSlashQuery, extractHeadingFoldRangesFromState, extractTocItemsFromState, filterSlashCommands, formatAttachmentMarkdown, getDefaultSlashCommands, getSlashMessages, headingFold, headingFoldTheme, isAcceptedAttachment, mardoraBaseTheme, markdownResetExtension, parseSelectedLink, readTocPanelState, resolveHeadingFoldConfig, resolveTocConfig, selectionToolbar, selectionToolbarTheme, slashCommands, slashMenuTheme, stripMarkdownHeadingText, tableOfContents, tocTheme, uploadAttachmentFile, writeTocPanelState } from './editor/index.js';
|
|
5
|
-
export { CODE_COPY_SUCCESS_ICON, CalloutLabel, CalloutTitleInputTarget, CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './plugins/index.js';
|
|
5
|
+
export { CODE_COPY_SUCCESS_ICON, CalloutLabel, CalloutTitleInputTarget, CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './plugins/index.js';
|
|
6
6
|
export { PreviewRenderer, defaultRenderers, escapeHtml, extractPreviewTocFromMarkdown, generateCSS, generateSyntaxThemeCSS, preview } from './preview/index.js';
|
|
7
7
|
export { G as GenerateCSSConfig, N as NodeRenderer, a as NodeRendererMap, P as PreviewConfig, b as PreviewContext, S as SyntaxThemeInput } from './types-Pw2SWWAR.js';
|
|
8
8
|
export { WrapSelectionMarkerMap, createWrapSelectionInputHandler } from './lib/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { CODE_COPY_SUCCESS_ICON, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './chunk-3OCUX4OO.js';
|
|
1
|
+
export { CODE_COPY_SUCCESS_ICON, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from './chunk-SMHHXYOS.js';
|
|
3
2
|
export { Compartment, DecorationPlugin, EditorSelection, EditorState, EditorView, MardoraPlugin, StateEffect, StateField, SyntaxPlugin, attachments, buildBlockTypeChange, buildInlineFormatChange, buildLinkChange, buildListChange, buildSlashReplacement, computeSelectionToolbarLayout, createSelectionToolbarElement, createSlashMenuElement, createSlashRuntimeConfig, createUploadMarker, defaultMardoraLocale, defaultSlashCommands, detectAttachmentKind, detectSelectionBlockType, detectSlashQuery, extractHeadingFoldRangesFromState, filterSlashCommands, formatAttachmentMarkdown, getDefaultSlashCommands, getSelectionToolbarMessages, getSlashMessages, headingFold, headingFoldTheme, highlightActiveLine, isAcceptedAttachment, keymap, mardora, mardoraBaseTheme, markdownResetExtension, parseSelectedLink, resolveHeadingFoldConfig, resolveMardoraLocale, selectionToolbar, selectionToolbarTheme, slashCommands, slashMenuTheme, uploadAttachmentFile } from './chunk-XL6WFGJT.js';
|
|
4
3
|
export { createWrapSelectionInputHandler } from './chunk-BIKZQZ6W.js';
|
|
4
|
+
export { extractPreviewTocFromMarkdown, generateCSS, preview } from './chunk-G4SE26YY.js';
|
|
5
5
|
export { PreviewRenderer, defaultRenderers, escapeHtml, generateSyntaxThemeCSS } from './chunk-EQJESPP2.js';
|
|
6
6
|
export { ThemeEnum, clampTocWidth, createMardoraIcon, createTheme, createTocPanelElement, createTocSlugger, cursorInRange, deepMerge, extractTocItemsFromState, fixSelector, flattenThemeStyles, hasMardoraIcon, readTocPanelState, resolveTocConfig, selectionOverlapsRange, stripMarkdownHeadingText, tableOfContents, tocTheme, toggleMarkdownStyle, writeTocPanelState } from './chunk-P7JFCYU3.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/plugins/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkU3D2P2CM_cjs = require('../chunk-U3D2P2CM.cjs');
|
|
4
4
|
require('../chunk-MLBEBFHB.cjs');
|
|
5
5
|
require('../chunk-KNDWF2DP.cjs');
|
|
6
6
|
require('../chunk-SWFUKJDO.cjs');
|
|
@@ -10,95 +10,99 @@ require('../chunk-WFVCG4LD.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "CODE_COPY_SUCCESS_ICON", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkU3D2P2CM_cjs.CODE_COPY_SUCCESS_ICON; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "CodePlugin", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkU3D2P2CM_cjs.CodePlugin; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "EmojiPlugin", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkU3D2P2CM_cjs.EmojiPlugin; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "HRPlugin", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkU3D2P2CM_cjs.HRPlugin; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "HTMLPlugin", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkU3D2P2CM_cjs.HTMLPlugin; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "HeadingPlugin", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkU3D2P2CM_cjs.HeadingPlugin; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "ImagePlugin", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkU3D2P2CM_cjs.ImagePlugin; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "InlinePlugin", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkU3D2P2CM_cjs.InlinePlugin; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "LinkPlugin", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkU3D2P2CM_cjs.LinkPlugin; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "ListPlugin", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkU3D2P2CM_cjs.ListPlugin; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "MathPlugin", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkU3D2P2CM_cjs.MathPlugin; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "MermaidPlugin", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkU3D2P2CM_cjs.MermaidPlugin; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "ParagraphPlugin", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkU3D2P2CM_cjs.ParagraphPlugin; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "QuotePlugin", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkU3D2P2CM_cjs.QuotePlugin; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "TablePlugin", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkU3D2P2CM_cjs.TablePlugin; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "allPlugins", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkU3D2P2CM_cjs.allPlugins; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "bindCodeCopyButtons", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkU3D2P2CM_cjs.bindCodeCopyButtons; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "bindImagePreviewButtons", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunkU3D2P2CM_cjs.bindImagePreviewButtons; }
|
|
78
82
|
});
|
|
79
83
|
Object.defineProperty(exports, "copyCodeTextToClipboard", {
|
|
80
84
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkU3D2P2CM_cjs.copyCodeTextToClipboard; }
|
|
82
86
|
});
|
|
83
87
|
Object.defineProperty(exports, "decodeCodeCopyPayload", {
|
|
84
88
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkU3D2P2CM_cjs.decodeCodeCopyPayload; }
|
|
86
90
|
});
|
|
87
91
|
Object.defineProperty(exports, "encodeCodeCopyPayload", {
|
|
88
92
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkU3D2P2CM_cjs.encodeCodeCopyPayload; }
|
|
90
94
|
});
|
|
91
95
|
Object.defineProperty(exports, "essentialPlugins", {
|
|
92
96
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkU3D2P2CM_cjs.essentialPlugins; }
|
|
94
98
|
});
|
|
95
99
|
Object.defineProperty(exports, "resolveCalloutTitleInputTarget", {
|
|
96
100
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkU3D2P2CM_cjs.resolveCalloutTitleInputTarget; }
|
|
98
102
|
});
|
|
99
103
|
Object.defineProperty(exports, "resolveCalloutTypeChange", {
|
|
100
104
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkU3D2P2CM_cjs.resolveCalloutTypeChange; }
|
|
102
106
|
});
|
|
103
107
|
//# sourceMappingURL=index.cjs.map
|
|
104
108
|
//# sourceMappingURL=index.cjs.map
|
package/dist/plugins/index.d.cts
CHANGED
|
@@ -308,6 +308,7 @@ declare class HTMLPlugin extends DecorationPlugin {
|
|
|
308
308
|
buildDecorations(ctx: DecorationContext): void;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
declare function bindImagePreviewButtons(root: HTMLElement | Document): () => void;
|
|
311
312
|
/**
|
|
312
313
|
* ImagePlugin - Decorates and renders images in markdown
|
|
313
314
|
*
|
|
@@ -737,4 +738,4 @@ declare const essentialPlugins: MardoraPlugin[];
|
|
|
737
738
|
*/
|
|
738
739
|
declare const allPlugins: MardoraPlugin[];
|
|
739
740
|
|
|
740
|
-
export { CODE_COPY_SUCCESS_ICON, type CalloutLabel, type CalloutTitleInputTarget, type CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange };
|
|
741
|
+
export { CODE_COPY_SUCCESS_ICON, type CalloutLabel, type CalloutTitleInputTarget, type CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -308,6 +308,7 @@ declare class HTMLPlugin extends DecorationPlugin {
|
|
|
308
308
|
buildDecorations(ctx: DecorationContext): void;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
declare function bindImagePreviewButtons(root: HTMLElement | Document): () => void;
|
|
311
312
|
/**
|
|
312
313
|
* ImagePlugin - Decorates and renders images in markdown
|
|
313
314
|
*
|
|
@@ -737,4 +738,4 @@ declare const essentialPlugins: MardoraPlugin[];
|
|
|
737
738
|
*/
|
|
738
739
|
declare const allPlugins: MardoraPlugin[];
|
|
739
740
|
|
|
740
|
-
export { CODE_COPY_SUCCESS_ICON, type CalloutLabel, type CalloutTitleInputTarget, type CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange };
|
|
741
|
+
export { CODE_COPY_SUCCESS_ICON, type CalloutLabel, type CalloutTitleInputTarget, type CalloutTypeChange, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange };
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CODE_COPY_SUCCESS_ICON, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from '../chunk-
|
|
1
|
+
export { CODE_COPY_SUCCESS_ICON, CodePlugin, EmojiPlugin, HRPlugin, HTMLPlugin, HeadingPlugin, ImagePlugin, InlinePlugin, LinkPlugin, ListPlugin, MathPlugin, MermaidPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, allPlugins, bindCodeCopyButtons, bindImagePreviewButtons, copyCodeTextToClipboard, decodeCodeCopyPayload, encodeCodeCopyPayload, essentialPlugins, resolveCalloutTitleInputTarget, resolveCalloutTypeChange } from '../chunk-SMHHXYOS.js';
|
|
2
2
|
import '../chunk-XL6WFGJT.js';
|
|
3
3
|
import '../chunk-BIKZQZ6W.js';
|
|
4
4
|
import '../chunk-EQJESPP2.js';
|
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ export function createMediaPreviewButton(
|
|
|
55
55
|
|
|
56
56
|
export function openMediaLightbox(ownerDocument: Document, options: OpenMediaLightboxOptions): MediaLightboxHandle {
|
|
57
57
|
ownerDocument.querySelector(".cm-mardora-media-lightbox")?.remove();
|
|
58
|
-
const mountPoint = options.returnFocus?.closest(".cm-editor") ?? ownerDocument.body;
|
|
58
|
+
const mountPoint = options.returnFocus?.closest(".cm-editor, .mardora-preview") ?? ownerDocument.body;
|
|
59
59
|
|
|
60
60
|
const root = ownerDocument.createElement("div");
|
|
61
61
|
root.className = "cm-mardora-media-lightbox";
|
|
@@ -6,7 +6,7 @@ export const codePluginTheme = createTheme({
|
|
|
6
6
|
// Inline code
|
|
7
7
|
".cm-mardora-code-inline": {
|
|
8
8
|
fontFamily: "var(--font-jetbrains-mono, monospace)",
|
|
9
|
-
fontSize: "0.
|
|
9
|
+
fontSize: "0.9em",
|
|
10
10
|
backgroundColor: "rgba(0, 0, 0, 0.05)",
|
|
11
11
|
padding: "0.1rem 0.25rem",
|
|
12
12
|
border: "1px solid var(--color-border)",
|
|
@@ -58,12 +58,11 @@ export const codePluginTheme = createTheme({
|
|
|
58
58
|
alignItems: "center",
|
|
59
59
|
gap: "0.2rem",
|
|
60
60
|
position: "absolute",
|
|
61
|
-
top: "
|
|
61
|
+
top: "0.5rem",
|
|
62
62
|
right: "0.45rem",
|
|
63
63
|
zIndex: "20",
|
|
64
64
|
opacity: "0",
|
|
65
65
|
pointerEvents: "none",
|
|
66
|
-
transform: "translateY(-50%)",
|
|
67
66
|
transition: "opacity 0.12s ease",
|
|
68
67
|
color: "var(--color-text, inherit)",
|
|
69
68
|
fontFamily: "var(--font-sans, system-ui, sans-serif)",
|
|
@@ -53,6 +53,7 @@ const codeLanguageOptions = [
|
|
|
53
53
|
["JavaScript", "javascript"],
|
|
54
54
|
["JSON", "json"],
|
|
55
55
|
["Markdown", "markdown"],
|
|
56
|
+
["Mermaid", "mermaid"],
|
|
56
57
|
["Python", "python"],
|
|
57
58
|
["Ruby", "ruby"],
|
|
58
59
|
["Rust", "rust"],
|
|
@@ -80,6 +81,7 @@ const codeLanguageAliases: Record<string, string> = {
|
|
|
80
81
|
js: "JavaScript",
|
|
81
82
|
json: "JSON",
|
|
82
83
|
markdown: "Markdown",
|
|
84
|
+
mermaid: "Mermaid",
|
|
83
85
|
md: "Markdown",
|
|
84
86
|
python: "Python",
|
|
85
87
|
py: "Python",
|
|
@@ -44,6 +44,16 @@ interface ImageMarkdownRange {
|
|
|
44
44
|
|
|
45
45
|
const imageWidthAttributePattern = /^(\s*)\{width=(\d+)\}/;
|
|
46
46
|
const minImageWidth = 120;
|
|
47
|
+
const imageWidgetEditorSelectionEventTypes = new Set([
|
|
48
|
+
"mousedown",
|
|
49
|
+
"mouseup",
|
|
50
|
+
"mousemove",
|
|
51
|
+
"pointerdown",
|
|
52
|
+
"pointermove",
|
|
53
|
+
"pointerup",
|
|
54
|
+
]);
|
|
55
|
+
const previewImageIcon =
|
|
56
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6"></path><path d="m21 3-7 7"></path><path d="M9 21H3v-6"></path><path d="m3 21 7-7"></path></svg>';
|
|
47
57
|
|
|
48
58
|
/**
|
|
49
59
|
* Parse image markdown to extract alt text, URL, optional title, and optional pixel width.
|
|
@@ -131,6 +141,29 @@ export function resolveImageDeleteChange(input: {
|
|
|
131
141
|
return { from: input.from, to: range.to, insert: "" };
|
|
132
142
|
}
|
|
133
143
|
|
|
144
|
+
export function bindImagePreviewButtons(root: HTMLElement | Document): () => void {
|
|
145
|
+
const onClick = (event: Event) => {
|
|
146
|
+
const target =
|
|
147
|
+
event.target && typeof (event.target as Element).closest === "function" ? (event.target as Element) : null;
|
|
148
|
+
const previewButton = target?.closest<HTMLButtonElement>(".cm-mardora-image-preview-button[data-src]");
|
|
149
|
+
if (!previewButton || !root.contains(previewButton)) return;
|
|
150
|
+
|
|
151
|
+
consumeMediaLightboxTrigger(event);
|
|
152
|
+
openMediaLightbox(previewButton.ownerDocument, {
|
|
153
|
+
content: {
|
|
154
|
+
kind: "image",
|
|
155
|
+
src: previewButton.dataset.src ?? "",
|
|
156
|
+
alt: previewButton.dataset.alt ?? "",
|
|
157
|
+
...(previewButton.dataset.title ? { title: previewButton.dataset.title } : {}),
|
|
158
|
+
},
|
|
159
|
+
returnFocus: previewButton,
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
root.addEventListener("click", onClick);
|
|
164
|
+
return () => root.removeEventListener("click", onClick);
|
|
165
|
+
}
|
|
166
|
+
|
|
134
167
|
/**
|
|
135
168
|
* Widget to render an image with optional caption using figure/figcaption
|
|
136
169
|
* Placed below the markdown syntax as a widget decoration
|
|
@@ -236,9 +269,8 @@ class ImageWidget extends WidgetType {
|
|
|
236
269
|
}
|
|
237
270
|
|
|
238
271
|
override ignoreEvent(event: Event) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
);
|
|
272
|
+
if (imageWidgetEditorSelectionEventTypes.has(event.type)) return true;
|
|
273
|
+
return event.type !== "click";
|
|
242
274
|
}
|
|
243
275
|
|
|
244
276
|
private createToolbar(view: EditorView, figure: HTMLElement): HTMLElement {
|
|
@@ -362,11 +394,18 @@ function clampImageWidth(width: number, maxWidth: number): number {
|
|
|
362
394
|
}
|
|
363
395
|
|
|
364
396
|
function resolveImageMaxWidth(view: EditorView, figure: HTMLElement): number {
|
|
365
|
-
const content = figure.closest(".cm-content") ?? view.contentDOM ?? view.dom;
|
|
397
|
+
const content = figure.closest(".cm-line") ?? figure.closest(".cm-content") ?? view.contentDOM ?? view.dom;
|
|
366
398
|
const width = content.getBoundingClientRect().width;
|
|
367
399
|
return Math.max(minImageWidth, Math.round(width || figure.getBoundingClientRect().width || 800));
|
|
368
400
|
}
|
|
369
401
|
|
|
402
|
+
function renderPreviewImageButton(parsed: ParsedImageMarkdown, ctx: PreviewContext): string {
|
|
403
|
+
const titleDataAttr = parsed.title ? ` data-title="${ctx.sanitize(parsed.title)}"` : "";
|
|
404
|
+
return `<div class="cm-mardora-image-toolbar">
|
|
405
|
+
<button type="button" class="cm-mardora-image-tool-button cm-mardora-image-preview-button" aria-label="放大查看图片" title="放大查看图片" data-src="${ctx.sanitize(parsed.url)}" data-alt="${ctx.sanitize(parsed.alt)}"${titleDataAttr}>${previewImageIcon}</button>
|
|
406
|
+
</div>`;
|
|
407
|
+
}
|
|
408
|
+
|
|
370
409
|
/**
|
|
371
410
|
* ImagePlugin - Decorates and renders images in markdown
|
|
372
411
|
*
|
|
@@ -583,10 +622,12 @@ export class ImagePlugin extends DecorationPlugin {
|
|
|
583
622
|
const altAttr = ctx.sanitize(parsed.alt);
|
|
584
623
|
const titleAttr = parsed.title ? ` title="${ctx.sanitize(parsed.title)}"` : "";
|
|
585
624
|
const ariaLabel = parsed.title ? ` aria-label="${ctx.sanitize(parsed.title)}"` : "";
|
|
586
|
-
const
|
|
625
|
+
const figureWidthStyle = parsed.width ? ` style="width: ${parsed.width}px;"` : "";
|
|
626
|
+
const imageWidthStyle = parsed.width ? ` style="width: 100%;"` : "";
|
|
587
627
|
|
|
588
|
-
let html = `<figure class="cm-mardora-image-figure" role="figure"${ariaLabel}>`;
|
|
589
|
-
html += `<img class="cm-mardora-image" src="${ctx.sanitize(parsed.url)}" alt="${altAttr}"${titleAttr}${
|
|
628
|
+
let html = `<figure class="cm-mardora-image-figure" role="figure"${ariaLabel}${figureWidthStyle}>`;
|
|
629
|
+
html += `<img class="cm-mardora-image" src="${ctx.sanitize(parsed.url)}" alt="${altAttr}"${titleAttr}${imageWidthStyle} loading="lazy" decoding="async" />`;
|
|
630
|
+
html += renderPreviewImageButton(parsed, ctx);
|
|
590
631
|
|
|
591
632
|
if (parsed.title) {
|
|
592
633
|
html += `<figcaption class="cm-mardora-image-caption">${ctx.sanitize(parsed.title)}</figcaption>`;
|
|
@@ -644,7 +685,9 @@ const imageTheme = createTheme({
|
|
|
644
685
|
alignItems: "start",
|
|
645
686
|
width: "100%",
|
|
646
687
|
maxWidth: "100%",
|
|
688
|
+
margin: "0",
|
|
647
689
|
padding: "0",
|
|
690
|
+
position: "relative",
|
|
648
691
|
},
|
|
649
692
|
|
|
650
693
|
".cm-mardora-image-toolbar": {
|
package/src/plugins/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { LinkPlugin } from "./link-plugin";
|
|
|
6
6
|
export { ListPlugin } from "./list-plugin";
|
|
7
7
|
export { TablePlugin } from "./table-plugin";
|
|
8
8
|
export { HTMLPlugin } from "./html-plugin";
|
|
9
|
-
export { ImagePlugin } from "./image-plugin";
|
|
9
|
+
export { bindImagePreviewButtons, ImagePlugin } from "./image-plugin";
|
|
10
10
|
export { MathPlugin } from "./math-plugin";
|
|
11
11
|
export { MermaidPlugin } from "./mermaid-plugin";
|
|
12
12
|
export {
|