@dskripchenko/markdown-editor 0.2.0 → 0.3.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +11 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +11 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9eedfee: `toolbarTarget` shows the visual mode's toolbar in the host's own element (wysiwyg 0.7), and `modeSwitch: false` hides the mode buttons when the host switches modes itself through `v-model:mode`.
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- dc2c5a0: `image-base` without a scheme (`/media/`): pictures shown from it are saved back relative as well.
|
|
14
|
+
|
|
3
15
|
## 0.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -128,11 +128,12 @@ function escapeHtml(text) {
|
|
|
128
128
|
* Anything else stays as it is.
|
|
129
129
|
*/
|
|
130
130
|
function relativeTo(url, base) {
|
|
131
|
+
const PLACEHOLDER = "http://base.invalid/";
|
|
131
132
|
let u;
|
|
132
133
|
let b;
|
|
133
134
|
try {
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
b = new URL(base, PLACEHOLDER);
|
|
136
|
+
u = new URL(url, b);
|
|
136
137
|
} catch {
|
|
137
138
|
return url;
|
|
138
139
|
}
|
|
@@ -236,6 +237,11 @@ var MarkdownEditor_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
236
237
|
maxHeight: { default: void 0 },
|
|
237
238
|
blockRenderers: { default: void 0 },
|
|
238
239
|
toolbarItems: { default: void 0 },
|
|
240
|
+
toolbarTarget: { default: void 0 },
|
|
241
|
+
modeSwitch: {
|
|
242
|
+
type: Boolean,
|
|
243
|
+
default: true
|
|
244
|
+
},
|
|
239
245
|
slashCommands: { default: void 0 },
|
|
240
246
|
locale: { default: void 0 },
|
|
241
247
|
labels: { default: void 0 },
|
|
@@ -337,7 +343,7 @@ var MarkdownEditor_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
337
343
|
"--dsk-md-min-h": __props.minHeight,
|
|
338
344
|
"--dsk-md-max-h": __props.maxHeight
|
|
339
345
|
})
|
|
340
|
-
}, [__props.modes.length > 1 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
346
|
+
}, [__props.modeSwitch && __props.modes.length > 1 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
341
347
|
key: 0,
|
|
342
348
|
class: "dsk-md__modes",
|
|
343
349
|
role: "group",
|
|
@@ -365,6 +371,7 @@ var MarkdownEditor_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
365
371
|
"max-height": __props.maxHeight,
|
|
366
372
|
"block-renderers": __props.blockRenderers,
|
|
367
373
|
"toolbar-items": __props.toolbarItems,
|
|
374
|
+
"toolbar-target": __props.toolbarTarget,
|
|
368
375
|
"slash-commands": __props.slashCommands,
|
|
369
376
|
locale: __props.locale,
|
|
370
377
|
"onUpdate:modelValue": onHtml
|
|
@@ -376,6 +383,7 @@ var MarkdownEditor_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
376
383
|
"max-height",
|
|
377
384
|
"block-renderers",
|
|
378
385
|
"toolbar-items",
|
|
386
|
+
"toolbar-target",
|
|
379
387
|
"slash-commands",
|
|
380
388
|
"locale"
|
|
381
389
|
])], 40, _hoisted_3)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4, [(0, vue.createElementVNode)("textarea", {
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {
|
|
|
24
24
|
modelValue: string;
|
|
25
25
|
placeholder: string;
|
|
26
26
|
toolbarItems: ToolbarItem[];
|
|
27
|
+
toolbarTarget: string | HTMLElement;
|
|
27
28
|
readonly: boolean;
|
|
28
29
|
minHeight: string;
|
|
29
30
|
maxHeight: string;
|
|
@@ -32,6 +33,7 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {
|
|
|
32
33
|
locale: MarkdownEditorLocale;
|
|
33
34
|
labels: Partial<MarkdownEditorLabels>;
|
|
34
35
|
modes: MarkdownEditorMode[];
|
|
36
|
+
modeSwitch: boolean;
|
|
35
37
|
linkBase: string;
|
|
36
38
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
37
39
|
|
|
@@ -48,6 +50,10 @@ declare type __VLS_Props = {
|
|
|
48
50
|
maxHeight?: string;
|
|
49
51
|
blockRenderers?: BlockRenderers;
|
|
50
52
|
toolbarItems?: ToolbarItems;
|
|
53
|
+
/** Where the visual mode's toolbar is shown instead of above the text (an element or a CSS selector): the host's own bar. */
|
|
54
|
+
toolbarTarget?: string | HTMLElement;
|
|
55
|
+
/** The mode buttons above the editor; off when the host switches modes itself (`v-model:mode`). */
|
|
56
|
+
modeSwitch?: boolean;
|
|
51
57
|
slashCommands?: SlashCommands;
|
|
52
58
|
locale?: MarkdownEditorLocale;
|
|
53
59
|
labels?: Partial<MarkdownEditorLabels>;
|
package/dist/index.mjs
CHANGED
|
@@ -127,11 +127,12 @@ function escapeHtml(text) {
|
|
|
127
127
|
* Anything else stays as it is.
|
|
128
128
|
*/
|
|
129
129
|
function relativeTo(url, base) {
|
|
130
|
+
const PLACEHOLDER = "http://base.invalid/";
|
|
130
131
|
let u;
|
|
131
132
|
let b;
|
|
132
133
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
b = new URL(base, PLACEHOLDER);
|
|
135
|
+
u = new URL(url, b);
|
|
135
136
|
} catch {
|
|
136
137
|
return url;
|
|
137
138
|
}
|
|
@@ -235,6 +236,11 @@ var MarkdownEditor_default = /* @__PURE__ */ defineComponent({
|
|
|
235
236
|
maxHeight: { default: void 0 },
|
|
236
237
|
blockRenderers: { default: void 0 },
|
|
237
238
|
toolbarItems: { default: void 0 },
|
|
239
|
+
toolbarTarget: { default: void 0 },
|
|
240
|
+
modeSwitch: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: true
|
|
243
|
+
},
|
|
238
244
|
slashCommands: { default: void 0 },
|
|
239
245
|
locale: { default: void 0 },
|
|
240
246
|
labels: { default: void 0 },
|
|
@@ -336,7 +342,7 @@ var MarkdownEditor_default = /* @__PURE__ */ defineComponent({
|
|
|
336
342
|
"--dsk-md-min-h": __props.minHeight,
|
|
337
343
|
"--dsk-md-max-h": __props.maxHeight
|
|
338
344
|
})
|
|
339
|
-
}, [__props.modes.length > 1 ? (openBlock(), createElementBlock("div", {
|
|
345
|
+
}, [__props.modeSwitch && __props.modes.length > 1 ? (openBlock(), createElementBlock("div", {
|
|
340
346
|
key: 0,
|
|
341
347
|
class: "dsk-md__modes",
|
|
342
348
|
role: "group",
|
|
@@ -364,6 +370,7 @@ var MarkdownEditor_default = /* @__PURE__ */ defineComponent({
|
|
|
364
370
|
"max-height": __props.maxHeight,
|
|
365
371
|
"block-renderers": __props.blockRenderers,
|
|
366
372
|
"toolbar-items": __props.toolbarItems,
|
|
373
|
+
"toolbar-target": __props.toolbarTarget,
|
|
367
374
|
"slash-commands": __props.slashCommands,
|
|
368
375
|
locale: __props.locale,
|
|
369
376
|
"onUpdate:modelValue": onHtml
|
|
@@ -375,6 +382,7 @@ var MarkdownEditor_default = /* @__PURE__ */ defineComponent({
|
|
|
375
382
|
"max-height",
|
|
376
383
|
"block-renderers",
|
|
377
384
|
"toolbar-items",
|
|
385
|
+
"toolbar-target",
|
|
378
386
|
"slash-commands",
|
|
379
387
|
"locale"
|
|
380
388
|
])], 40, _hoisted_3)) : (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("textarea", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dskripchenko/markdown-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A Markdown editor for Vue 3 that edits like a word processor: the value is Markdown, the editing is the @dskripchenko/wysiwyg engine — its toolbar, slash menu, shortcuts and live blocks — with source and side-by-side modes, and a lossless round trip",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@dskripchenko/ui": "^1.19.1",
|
|
55
|
-
"@dskripchenko/wysiwyg": "^0.
|
|
55
|
+
"@dskripchenko/wysiwyg": "^0.7.0",
|
|
56
56
|
"vue": "^3.4.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@changesets/cli": "^3.0.3",
|
|
60
60
|
"@dskripchenko/ui": "^1.19.1",
|
|
61
|
-
"@dskripchenko/wysiwyg": "^0.
|
|
61
|
+
"@dskripchenko/wysiwyg": "^0.7.0",
|
|
62
62
|
"@eslint/js": "^10.0.1",
|
|
63
63
|
"@microsoft/api-extractor": "^7.60.1",
|
|
64
64
|
"@types/node": "^22.20.5",
|