@milkdown/crepe 7.15.5 → 7.17.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/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +27 -22
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +1 -1
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +2 -2
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +30 -25
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +27 -22
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +2 -2
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +2 -2
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +31 -26
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts +2 -1
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts +0 -8
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/index.d.ts +2 -1
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/code-mirror/index.d.ts +2 -15
- package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/config.d.ts +5 -1
- package/lib/types/feature/toolbar/config.d.ts.map +1 -1
- package/lib/types/utils/group-builder.d.ts +1 -1
- package/lib/types/utils/group-builder.d.ts.map +1 -1
- package/package.json +3 -6
- package/src/feature/block-edit/handle/component.tsx +1 -1
- package/src/feature/block-edit/handle/index.ts +1 -1
- package/src/feature/block-edit/menu/index.ts +1 -1
- package/src/feature/code-mirror/index.ts +6 -23
- package/src/feature/cursor/index.ts +2 -2
- package/src/feature/latex/index.ts +2 -2
- package/src/utils/group-builder.ts +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -1558,34 +1558,39 @@ const codeMirror = (editor, config = {}) => {
|
|
|
1558
1558
|
if (config.extensions) {
|
|
1559
1559
|
extensions.push(...config.extensions);
|
|
1560
1560
|
}
|
|
1561
|
-
ctx.update(codeBlock.codeBlockConfig.key, (defaultConfig) =>
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1561
|
+
ctx.update(codeBlock.codeBlockConfig.key, (defaultConfig) => {
|
|
1562
|
+
var _a;
|
|
1563
|
+
return {
|
|
1564
|
+
extensions,
|
|
1565
|
+
languages,
|
|
1566
|
+
expandIcon: config.expandIcon || chevronDownIcon,
|
|
1567
|
+
searchIcon: config.searchIcon || searchIcon,
|
|
1568
|
+
clearSearchIcon: config.clearSearchIcon || clearIcon,
|
|
1569
|
+
searchPlaceholder: config.searchPlaceholder || "Search language",
|
|
1570
|
+
copyText: config.copyText || "Copy",
|
|
1571
|
+
copyIcon: config.copyIcon || copyIcon,
|
|
1572
|
+
onCopy: config.onCopy || (() => {
|
|
1573
|
+
}),
|
|
1574
|
+
noResultText: config.noResultText || "No result",
|
|
1575
|
+
renderLanguage: config.renderLanguage || defaultConfig.renderLanguage,
|
|
1576
|
+
renderPreview: config.renderPreview || defaultConfig.renderPreview,
|
|
1577
|
+
previewToggleButton: (previewOnlyMode) => {
|
|
1578
|
+
var _a2, _b;
|
|
1579
|
+
const icon = ((_a2 = config.previewToggleIcon) == null ? void 0 : _a2.call(config, previewOnlyMode)) || (previewOnlyMode ? editIcon : visibilityOffIcon);
|
|
1580
|
+
const text = ((_b = config.previewToggleText) == null ? void 0 : _b.call(config, previewOnlyMode)) || (previewOnlyMode ? "Edit" : "Hide");
|
|
1581
|
+
return [icon, text].map((v) => v.trim()).join(" ");
|
|
1582
|
+
},
|
|
1583
|
+
previewLabel: config.previewLabel || defaultConfig.previewLabel,
|
|
1584
|
+
previewLoading: config.previewLoading || defaultConfig.previewLoading,
|
|
1585
|
+
previewOnlyByDefault: (_a = config.previewOnlyByDefault) != null ? _a : defaultConfig.previewOnlyByDefault
|
|
1586
|
+
};
|
|
1587
|
+
});
|
|
1583
1588
|
}).use(codeBlock.codeBlockComponent);
|
|
1584
1589
|
};
|
|
1585
1590
|
|
|
1586
1591
|
const cursor = (editor, config) => {
|
|
1587
1592
|
editor.config(crepeFeatureConfig(CrepeFeature.Cursor)).config((ctx) => {
|
|
1588
|
-
ctx.update(cursor$1.
|
|
1593
|
+
ctx.update(cursor$1.dropIndicatorConfig.key, () => {
|
|
1589
1594
|
var _a, _b;
|
|
1590
1595
|
return {
|
|
1591
1596
|
class: "crepe-drop-cursor",
|
|
@@ -1949,12 +1954,12 @@ const latex = (editor, config) => {
|
|
|
1949
1954
|
}
|
|
1950
1955
|
ctx.update(codeBlock.codeBlockConfig.key, (prev) => ({
|
|
1951
1956
|
...prev,
|
|
1952
|
-
renderPreview: (language, content) => {
|
|
1957
|
+
renderPreview: (language, content, applyPreview) => {
|
|
1953
1958
|
if (language.toLowerCase() === "latex" && content.length > 0) {
|
|
1954
1959
|
return renderLatex(content, config == null ? void 0 : config.katexOptions);
|
|
1955
1960
|
}
|
|
1956
1961
|
const renderPreview = prev.renderPreview;
|
|
1957
|
-
return renderPreview(language, content);
|
|
1962
|
+
return renderPreview(language, content, applyPreview);
|
|
1958
1963
|
}
|
|
1959
1964
|
}));
|
|
1960
1965
|
ctx.set(inlineLatexTooltip.key, {
|