@jvs-milkdown/crepe 1.2.7 → 1.2.9
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/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +47 -30
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +47 -30
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/feature/fixed-toolbar/config.ts +32 -29
- package/src/feature/fixed-toolbar/document-header.tsx +19 -0
- package/src/feature/index.ts +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -71,7 +71,7 @@ const defaultFeatures = {
|
|
|
71
71
|
["block-edit" /* BlockEdit */]: true,
|
|
72
72
|
["placeholder" /* Placeholder */]: true,
|
|
73
73
|
["toolbar" /* Toolbar */]: true,
|
|
74
|
-
["fixed-toolbar" /* FixedToolbar */]:
|
|
74
|
+
["fixed-toolbar" /* FixedToolbar */]: true,
|
|
75
75
|
["code-mirror" /* CodeMirror */]: true,
|
|
76
76
|
["table" /* Table */]: true,
|
|
77
77
|
["latex" /* Latex */]: true,
|
|
@@ -8581,6 +8581,35 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
8581
8581
|
}
|
|
8582
8582
|
});
|
|
8583
8583
|
const blockGroup = builder.addGroup("block", "Block");
|
|
8584
|
+
if (isTableEnabled) {
|
|
8585
|
+
blockGroup.addItem("table", {
|
|
8586
|
+
label: ctx ? i18n(ctx, "menu.item.table") : "Table",
|
|
8587
|
+
icon: tableIcon,
|
|
8588
|
+
active: () => false,
|
|
8589
|
+
onRun: (ctx2) => {
|
|
8590
|
+
const commands = ctx2.get(core.commandsCtx);
|
|
8591
|
+
const view = ctx2.get(core.editorViewCtx);
|
|
8592
|
+
const { from } = view.state.selection;
|
|
8593
|
+
commands.call(commonmark.addBlockTypeCommand.key, {
|
|
8594
|
+
nodeType: gfm.createTable(ctx2, 3, 3)
|
|
8595
|
+
});
|
|
8596
|
+
commands.call(commonmark.selectTextNearPosCommand.key, { pos: from });
|
|
8597
|
+
}
|
|
8598
|
+
});
|
|
8599
|
+
}
|
|
8600
|
+
if (isImageBlockEnabled) {
|
|
8601
|
+
blockGroup.addItem("image", {
|
|
8602
|
+
label: ctx ? i18n(ctx, "menu.item.image") : "Image",
|
|
8603
|
+
icon: imageIcon,
|
|
8604
|
+
active: () => false,
|
|
8605
|
+
onRun: (ctx2) => {
|
|
8606
|
+
const commands = ctx2.get(core.commandsCtx);
|
|
8607
|
+
commands.call(commonmark.addBlockTypeCommand.key, {
|
|
8608
|
+
nodeType: imageBlock$1.imageBlockSchema.type(ctx2)
|
|
8609
|
+
});
|
|
8610
|
+
}
|
|
8611
|
+
});
|
|
8612
|
+
}
|
|
8584
8613
|
blockGroup.addItem("quote", {
|
|
8585
8614
|
label: ctx ? i18n(ctx, "menu.item.quote") : "Quote",
|
|
8586
8615
|
icon: quoteIcon,
|
|
@@ -8647,19 +8676,6 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
8647
8676
|
commands.call(linkTooltip$1.toggleLinkCommand.key);
|
|
8648
8677
|
}
|
|
8649
8678
|
});
|
|
8650
|
-
if (isImageBlockEnabled) {
|
|
8651
|
-
blockGroup.addItem("image", {
|
|
8652
|
-
label: ctx ? i18n(ctx, "menu.item.image") : "Image",
|
|
8653
|
-
icon: imageIcon,
|
|
8654
|
-
active: () => false,
|
|
8655
|
-
onRun: (ctx2) => {
|
|
8656
|
-
const commands = ctx2.get(core.commandsCtx);
|
|
8657
|
-
commands.call(commonmark.addBlockTypeCommand.key, {
|
|
8658
|
-
nodeType: imageBlock$1.imageBlockSchema.type(ctx2)
|
|
8659
|
-
});
|
|
8660
|
-
}
|
|
8661
|
-
});
|
|
8662
|
-
}
|
|
8663
8679
|
if (isAttachmentEnabled) {
|
|
8664
8680
|
blockGroup.addItem("attachment", {
|
|
8665
8681
|
label: ctx ? i18n(ctx, "menu.item.attachment") : "Video or File",
|
|
@@ -8712,22 +8728,6 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
8712
8728
|
});
|
|
8713
8729
|
}
|
|
8714
8730
|
});
|
|
8715
|
-
if (isTableEnabled) {
|
|
8716
|
-
blockGroup.addItem("table", {
|
|
8717
|
-
label: ctx ? i18n(ctx, "menu.item.table") : "Table",
|
|
8718
|
-
icon: tableIcon,
|
|
8719
|
-
active: () => false,
|
|
8720
|
-
onRun: (ctx2) => {
|
|
8721
|
-
const commands = ctx2.get(core.commandsCtx);
|
|
8722
|
-
const view = ctx2.get(core.editorViewCtx);
|
|
8723
|
-
const { from } = view.state.selection;
|
|
8724
|
-
commands.call(commonmark.addBlockTypeCommand.key, {
|
|
8725
|
-
nodeType: gfm.createTable(ctx2, 3, 3)
|
|
8726
|
-
});
|
|
8727
|
-
commands.call(commonmark.selectTextNearPosCommand.key, { pos: from });
|
|
8728
|
-
}
|
|
8729
|
-
});
|
|
8730
|
-
}
|
|
8731
8731
|
if (isLatexEnabled) {
|
|
8732
8732
|
blockGroup.addItem("math-block", {
|
|
8733
8733
|
label: ctx ? i18n(ctx, "menu.item.math") : "Math Block",
|
|
@@ -9003,6 +9003,23 @@ const DocumentHeader = vue.defineComponent({
|
|
|
9003
9003
|
title.value = e.target.value;
|
|
9004
9004
|
adjustTitleHeight();
|
|
9005
9005
|
},
|
|
9006
|
+
onKeydown: (e) => {
|
|
9007
|
+
if (e.key !== "Enter") return;
|
|
9008
|
+
e.preventDefault();
|
|
9009
|
+
if (e.ctrlKey || e.metaKey) {
|
|
9010
|
+
const target = e.target;
|
|
9011
|
+
const start = target.selectionStart;
|
|
9012
|
+
const end = target.selectionEnd;
|
|
9013
|
+
title.value = title.value.slice(0, start) + "\n" + title.value.slice(end);
|
|
9014
|
+
requestAnimationFrame(() => {
|
|
9015
|
+
target.selectionStart = target.selectionEnd = start + 1;
|
|
9016
|
+
adjustTitleHeight();
|
|
9017
|
+
});
|
|
9018
|
+
} else {
|
|
9019
|
+
const view = props.ctx.get(core.editorViewCtx);
|
|
9020
|
+
view == null ? void 0 : view.focus();
|
|
9021
|
+
}
|
|
9022
|
+
},
|
|
9006
9023
|
rows: 1,
|
|
9007
9024
|
style: {
|
|
9008
9025
|
width: "100%",
|