@novaprose/core 0.1.0 → 0.2.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/dist/advlist-FRIJ6LO7.js +107 -0
- package/dist/advlist-FRIJ6LO7.js.map +1 -0
- package/dist/autolink-ZVHNOOS7.js +89 -0
- package/dist/autolink-ZVHNOOS7.js.map +1 -0
- package/dist/autoresize-WT4ONZKK.js +26 -0
- package/dist/autoresize-WT4ONZKK.js.map +1 -0
- package/dist/autosave-2KI5WGV5.js +99 -0
- package/dist/autosave-2KI5WGV5.js.map +1 -0
- package/dist/charmap-3LM5LZCC.js +197 -0
- package/dist/charmap-3LM5LZCC.js.map +1 -0
- package/dist/chunk-6RJENZXT.js +104 -0
- package/dist/chunk-6RJENZXT.js.map +1 -0
- package/dist/{chunk-TKR3C5IJ.js → chunk-AGBQEZ2U.js} +300 -681
- package/dist/chunk-AGBQEZ2U.js.map +1 -0
- package/dist/{chunk-ZF2JR3JH.js → chunk-F6TSOU5U.js} +1 -1
- package/dist/chunk-F6TSOU5U.js.map +1 -0
- package/dist/chunk-GHEFKKRC.js +268 -0
- package/dist/chunk-GHEFKKRC.js.map +1 -0
- package/dist/chunk-HZRIBOPW.js +52 -0
- package/dist/chunk-HZRIBOPW.js.map +1 -0
- package/dist/chunk-YZPJQB3I.js +490 -0
- package/dist/chunk-YZPJQB3I.js.map +1 -0
- package/dist/directionality-VSDWPWHX.js +70 -0
- package/dist/directionality-VSDWPWHX.js.map +1 -0
- package/dist/emoticons-YVGVA76P.js +216 -0
- package/dist/emoticons-YVGVA76P.js.map +1 -0
- package/dist/index.cjs +3762 -1175
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -10
- package/dist/index.d.ts +177 -10
- package/dist/index.js +1316 -95
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-C4MAC5L7.js → insertdatetime-QYWZUYO4.js} +2 -2
- package/dist/nonbreaking-SIACL5V6.js +46 -0
- package/dist/nonbreaking-SIACL5V6.js.map +1 -0
- package/dist/{quickbars-XK4QCQ6F.js → quickbars-WW3TGVCS.js} +7 -5
- package/dist/quickbars-WW3TGVCS.js.map +1 -0
- package/dist/visualblocks-WB6NAEGB.js +43 -0
- package/dist/visualblocks-WB6NAEGB.js.map +1 -0
- package/package.json +5 -2
- package/src/style.css +180 -0
- package/dist/chunk-TKR3C5IJ.js.map +0 -1
- package/dist/chunk-ZF2JR3JH.js.map +0 -1
- package/dist/quickbars-XK4QCQ6F.js.map +0 -1
- /package/dist/{insertdatetime-C4MAC5L7.js.map → insertdatetime-QYWZUYO4.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
definePlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F6TSOU5U.js";
|
|
4
4
|
|
|
5
5
|
// src/plugins/insertdatetime.ts
|
|
6
6
|
var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/><path d="M12 13v3l2 1"/></svg>';
|
|
@@ -61,4 +61,4 @@ var insertdatetime_default = definePlugin({
|
|
|
61
61
|
export {
|
|
62
62
|
insertdatetime_default as default
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=insertdatetime-
|
|
64
|
+
//# sourceMappingURL=insertdatetime-QYWZUYO4.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
insertText,
|
|
3
|
+
pickLabels
|
|
4
|
+
} from "./chunk-6RJENZXT.js";
|
|
5
|
+
import "./chunk-HZRIBOPW.js";
|
|
6
|
+
import {
|
|
7
|
+
definePlugin
|
|
8
|
+
} from "./chunk-F6TSOU5U.js";
|
|
9
|
+
|
|
10
|
+
// src/plugins/nonbreaking.ts
|
|
11
|
+
import { keymap } from "prosemirror-keymap";
|
|
12
|
+
var NBSP = String.fromCharCode(160);
|
|
13
|
+
var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9v5h16V9"/></svg>';
|
|
14
|
+
var LABELS = { en: { title: "Nonbreaking space" }, ru: { title: "\u041D\u0435\u0440\u0430\u0437\u0440\u044B\u0432\u043D\u044B\u0439 \u043F\u0440\u043E\u0431\u0435\u043B" } };
|
|
15
|
+
var nonbreaking_default = definePlugin({
|
|
16
|
+
name: "nonbreaking",
|
|
17
|
+
toolbar: "nonbreaking",
|
|
18
|
+
prosemirrorPlugins: () => [
|
|
19
|
+
keymap({
|
|
20
|
+
"Mod-Shift-Space": (state, dispatch) => {
|
|
21
|
+
dispatch?.(state.tr.insertText(NBSP).scrollIntoView());
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
],
|
|
26
|
+
setup(editor) {
|
|
27
|
+
const { title } = pickLabels(editor, LABELS);
|
|
28
|
+
const spec = {
|
|
29
|
+
icon: ICON,
|
|
30
|
+
tooltip: title,
|
|
31
|
+
shortcut: "Mod-Shift-Space",
|
|
32
|
+
isEnabled: () => editor.isEditable(),
|
|
33
|
+
onAction: () => insertText(editor, NBSP)
|
|
34
|
+
};
|
|
35
|
+
editor.ui.registry.addButton("nonbreaking", spec);
|
|
36
|
+
editor.ui.registry.addMenuItem("nonbreaking", {
|
|
37
|
+
text: title,
|
|
38
|
+
icon: ICON,
|
|
39
|
+
onAction: spec.onAction
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
nonbreaking_default as default
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=nonbreaking-SIACL5V6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/nonbreaking.ts"],"sourcesContent":["import { keymap } from 'prosemirror-keymap';\nimport { definePlugin } from '../plugins';\nimport { insertText, pickLabels } from './shared';\n\n/** Плагин nonbreaking: неразрывный пробел (кнопка и Ctrl/Cmd+Shift+Space). `plugins: ['nonbreaking']`. */\n\nconst NBSP = String.fromCharCode(0xa0);\nconst ICON =\n '<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 9v5h16V9\"/></svg>';\nconst LABELS = { en: { title: 'Nonbreaking space' }, ru: { title: 'Неразрывный пробел' } };\n\nexport default definePlugin({\n name: 'nonbreaking',\n toolbar: 'nonbreaking',\n prosemirrorPlugins: () => [\n keymap({\n 'Mod-Shift-Space': (state, dispatch) => {\n dispatch?.(state.tr.insertText(NBSP).scrollIntoView());\n return true;\n },\n }),\n ],\n setup(editor) {\n const { title } = pickLabels(editor, LABELS);\n const spec = {\n icon: ICON,\n tooltip: title,\n shortcut: 'Mod-Shift-Space',\n isEnabled: () => editor.isEditable(),\n onAction: () => insertText(editor, NBSP),\n };\n editor.ui.registry.addButton('nonbreaking', spec);\n editor.ui.registry.addMenuItem('nonbreaking', {\n text: title,\n icon: ICON,\n onAction: spec.onAction,\n });\n },\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,cAAc;AAMvB,IAAM,OAAO,OAAO,aAAa,GAAI;AACrC,IAAM,OACJ;AACF,IAAM,SAAS,EAAE,IAAI,EAAE,OAAO,oBAAoB,GAAG,IAAI,EAAE,OAAO,0GAAqB,EAAE;AAEzF,IAAO,sBAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,oBAAoB,MAAM;AAAA,IACxB,OAAO;AAAA,MACL,mBAAmB,CAAC,OAAO,aAAa;AACtC,mBAAW,MAAM,GAAG,WAAW,IAAI,EAAE,eAAe,CAAC;AACrD,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,MAAM,QAAQ;AACZ,UAAM,EAAE,MAAM,IAAI,WAAW,QAAQ,MAAM;AAC3C,UAAM,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAW,MAAM,OAAO,WAAW;AAAA,MACnC,UAAU,MAAM,WAAW,QAAQ,IAAI;AAAA,IACzC;AACA,WAAO,GAAG,SAAS,UAAU,eAAe,IAAI;AAChD,WAAO,GAAG,SAAS,YAAY,eAAe;AAAA,MAC5C,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,KAAK;AAAA,IACjB,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
|
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
isInTable,
|
|
5
5
|
isSupportedImage,
|
|
6
6
|
openLinkDialog,
|
|
7
|
-
schema,
|
|
8
7
|
uploadImages
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AGBQEZ2U.js";
|
|
9
|
+
import "./chunk-YZPJQB3I.js";
|
|
10
|
+
import "./chunk-GHEFKKRC.js";
|
|
11
|
+
import "./chunk-HZRIBOPW.js";
|
|
10
12
|
import {
|
|
11
13
|
definePlugin
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-F6TSOU5U.js";
|
|
13
15
|
|
|
14
16
|
// src/plugins/quickbars.ts
|
|
15
17
|
import { TextSelection } from "prosemirror-state";
|
|
@@ -25,7 +27,7 @@ function isOnEmptyLine(editor) {
|
|
|
25
27
|
const { selection } = editor.view.state;
|
|
26
28
|
if (!selection.empty) return false;
|
|
27
29
|
const { $from } = selection;
|
|
28
|
-
return $from.depth === 1 && $from.parent.type === schema.nodes.paragraph && $from.parent.content.size === 0 && !isInTable(editor.view.state);
|
|
30
|
+
return $from.depth === 1 && $from.parent.type === editor.schema.nodes.paragraph && $from.parent.content.size === 0 && !isInTable(editor.view.state);
|
|
29
31
|
}
|
|
30
32
|
function pickImage(editor) {
|
|
31
33
|
const input = document.createElement("input");
|
|
@@ -89,4 +91,4 @@ export {
|
|
|
89
91
|
hasTextSelection,
|
|
90
92
|
isOnEmptyLine
|
|
91
93
|
};
|
|
92
|
-
//# sourceMappingURL=quickbars-
|
|
94
|
+
//# sourceMappingURL=quickbars-WW3TGVCS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/quickbars.ts"],"sourcesContent":["import { TextSelection } from 'prosemirror-state';\nimport type { Editor } from '../editor';\nimport { isSupportedImage, uploadImages } from '../image';\nimport { openLinkDialog } from '../link';\nimport { definePlugin } from '../plugins';\nimport { insertTable, isInTable } from '../table';\nimport { icons } from '../ui/icons';\n\n/**\n * Quickbars: панели «по месту», как одноимённый плагин TinyMCE.\n * - над выделенным текстом — быстрое форматирование;\n * - на пустой строке — быстрая вставка (картинка, таблица).\n *\n * Настройки (pluginOptions.quickbars), false — выключить панель:\n * { selection: 'bold italic | quicklink h2 h3 blockquote', insert: 'quickimage quicktable' }\n */\nexport interface QuickbarsOptions {\n selection?: string | false;\n insert?: string | false;\n}\n\nexport const DEFAULT_SELECTION = 'bold italic underline | quicklink h2 h3 blockquote';\nexport const DEFAULT_INSERT = 'quickimage quicktable';\n\n/** Выделен непустой текст (не ячейки таблицы, не картинка), и не в блоке кода. */\nexport function hasTextSelection(editor: Editor): boolean {\n const { selection } = editor.view.state;\n if (!(selection instanceof TextSelection) || selection.empty) return false;\n if (selection.$from.parent.type.spec.code) return false;\n return editor.view.state.doc.textBetween(selection.from, selection.to).trim().length > 0;\n}\n\n/** Курсор на пустой строке верхнего уровня (не в списке, таблице, цитате). */\nexport function isOnEmptyLine(editor: Editor): boolean {\n const { selection } = editor.view.state;\n if (!selection.empty) return false;\n const { $from } = selection;\n return (\n $from.depth === 1 &&\n $from.parent.type === editor.schema.nodes.paragraph &&\n $from.parent.content.size === 0 &&\n !isInTable(editor.view.state)\n );\n}\n\nfunction pickImage(editor: Editor): void {\n const input = document.createElement('input');\n input.type = 'file';\n input.accept = 'image/png,image/jpeg,image/gif,image/webp,image/avif';\n input.addEventListener('change', () => {\n const files = [...(input.files ?? [])].filter(isSupportedImage);\n if (files.length) uploadImages(editor, files);\n });\n input.click();\n}\n\nexport default definePlugin({\n name: 'quickbars',\n setup(editor) {\n const { registry, t } = editor.ui;\n const options = (editor.options.pluginOptions?.quickbars ?? {}) as QuickbarsOptions;\n\n registry.addButton('quicklink', {\n icon: icons.link,\n tooltip: t('link'),\n shortcut: 'Mod-k',\n onAction: (e) => openLinkDialog(e),\n });\n registry.addButton('quickimage', {\n icon: icons.image,\n tooltip: t('image'),\n onAction: (e) => pickImage(e),\n });\n registry.addButton('quicktable', {\n icon: icons.table,\n tooltip: t('table.insert'),\n onAction: (e) => e.exec(insertTable(2, 2)),\n });\n\n const selection = options.selection === undefined ? DEFAULT_SELECTION : options.selection;\n if (selection) {\n registry.addContextToolbar('quickbars-selection', {\n label: t('quickbars.selection'),\n predicate: hasTextSelection,\n items: selection,\n position: 'selection',\n placement: 'top-start',\n // Выделение текста в таблице: форматирование важнее панели таблицы.\n priority: 10,\n });\n }\n\n const insert = options.insert === undefined ? DEFAULT_INSERT : options.insert;\n if (insert) {\n registry.addContextToolbar('quickbars-insert', {\n label: t('quickbars.insert'),\n predicate: isOnEmptyLine,\n items: insert,\n position: 'selection',\n placement: 'bottom-start',\n });\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAqBvB,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AAGvB,SAAS,iBAAiB,QAAyB;AACxD,QAAM,EAAE,UAAU,IAAI,OAAO,KAAK;AAClC,MAAI,EAAE,qBAAqB,kBAAkB,UAAU,MAAO,QAAO;AACrE,MAAI,UAAU,MAAM,OAAO,KAAK,KAAK,KAAM,QAAO;AAClD,SAAO,OAAO,KAAK,MAAM,IAAI,YAAY,UAAU,MAAM,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS;AACzF;AAGO,SAAS,cAAc,QAAyB;AACrD,QAAM,EAAE,UAAU,IAAI,OAAO,KAAK;AAClC,MAAI,CAAC,UAAU,MAAO,QAAO;AAC7B,QAAM,EAAE,MAAM,IAAI;AAClB,SACE,MAAM,UAAU,KAChB,MAAM,OAAO,SAAS,OAAO,OAAO,MAAM,aAC1C,MAAM,OAAO,QAAQ,SAAS,KAC9B,CAAC,UAAU,OAAO,KAAK,KAAK;AAEhC;AAEA,SAAS,UAAU,QAAsB;AACvC,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,OAAO;AACb,QAAM,SAAS;AACf,QAAM,iBAAiB,UAAU,MAAM;AACrC,UAAM,QAAQ,CAAC,GAAI,MAAM,SAAS,CAAC,CAAE,EAAE,OAAO,gBAAgB;AAC9D,QAAI,MAAM,OAAQ,cAAa,QAAQ,KAAK;AAAA,EAC9C,CAAC;AACD,QAAM,MAAM;AACd;AAEA,IAAO,oBAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,MAAM,QAAQ;AACZ,UAAM,EAAE,UAAU,EAAE,IAAI,OAAO;AAC/B,UAAM,UAAW,OAAO,QAAQ,eAAe,aAAa,CAAC;AAE7D,aAAS,UAAU,aAAa;AAAA,MAC9B,MAAM,MAAM;AAAA,MACZ,SAAS,EAAE,MAAM;AAAA,MACjB,UAAU;AAAA,MACV,UAAU,CAAC,MAAM,eAAe,CAAC;AAAA,IACnC,CAAC;AACD,aAAS,UAAU,cAAc;AAAA,MAC/B,MAAM,MAAM;AAAA,MACZ,SAAS,EAAE,OAAO;AAAA,MAClB,UAAU,CAAC,MAAM,UAAU,CAAC;AAAA,IAC9B,CAAC;AACD,aAAS,UAAU,cAAc;AAAA,MAC/B,MAAM,MAAM;AAAA,MACZ,SAAS,EAAE,cAAc;AAAA,MACzB,UAAU,CAAC,MAAM,EAAE,KAAK,YAAY,GAAG,CAAC,CAAC;AAAA,IAC3C,CAAC;AAED,UAAM,YAAY,QAAQ,cAAc,SAAY,oBAAoB,QAAQ;AAChF,QAAI,WAAW;AACb,eAAS,kBAAkB,uBAAuB;AAAA,QAChD,OAAO,EAAE,qBAAqB;AAAA,QAC9B,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA;AAAA,QAEX,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAEA,UAAM,SAAS,QAAQ,WAAW,SAAY,iBAAiB,QAAQ;AACvE,QAAI,QAAQ;AACV,eAAS,kBAAkB,oBAAoB;AAAA,QAC7C,OAAO,EAAE,kBAAkB;AAAA,QAC3B,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,QACV,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pickLabels
|
|
3
|
+
} from "./chunk-6RJENZXT.js";
|
|
4
|
+
import "./chunk-HZRIBOPW.js";
|
|
5
|
+
import {
|
|
6
|
+
definePlugin
|
|
7
|
+
} from "./chunk-F6TSOU5U.js";
|
|
8
|
+
|
|
9
|
+
// src/plugins/visualblocks.ts
|
|
10
|
+
var ICON = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 3" aria-hidden="true"><rect x="3" y="4" width="18" height="6" rx="1"/><rect x="3" y="14" width="18" height="6" rx="1"/></svg>';
|
|
11
|
+
var LABELS = { en: { title: "Show blocks" }, ru: { title: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0431\u043B\u043E\u043A\u0438" } };
|
|
12
|
+
var visualblocks_default = definePlugin({
|
|
13
|
+
name: "visualblocks",
|
|
14
|
+
toolbar: "visualblocks",
|
|
15
|
+
setup(editor) {
|
|
16
|
+
const { title } = pickLabels(editor, LABELS);
|
|
17
|
+
const options = editor.options.pluginOptions?.visualblocks ?? {};
|
|
18
|
+
const isOn = () => editor.root.classList.contains("nova-visualblocks");
|
|
19
|
+
const toggle = () => {
|
|
20
|
+
editor.root.classList.toggle("nova-visualblocks");
|
|
21
|
+
editor.updateUI();
|
|
22
|
+
editor.focus();
|
|
23
|
+
};
|
|
24
|
+
if (options.default) editor.root.classList.add("nova-visualblocks");
|
|
25
|
+
editor.ui.registry.addToggleButton("visualblocks", {
|
|
26
|
+
icon: ICON,
|
|
27
|
+
tooltip: title,
|
|
28
|
+
isActive: isOn,
|
|
29
|
+
onAction: toggle
|
|
30
|
+
});
|
|
31
|
+
editor.ui.registry.addToggleMenuItem("visualblocks", {
|
|
32
|
+
text: title,
|
|
33
|
+
icon: ICON,
|
|
34
|
+
isActive: isOn,
|
|
35
|
+
onAction: toggle
|
|
36
|
+
});
|
|
37
|
+
return () => editor.root.classList.remove("nova-visualblocks");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
visualblocks_default as default
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=visualblocks-WB6NAEGB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/visualblocks.ts"],"sourcesContent":["import { definePlugin } from '../plugins';\nimport { pickLabels } from './shared';\n\n/**\n * Плагин visualblocks: показать границы блоков (абзацы, заголовки, списки, цитаты, таблицы)\n * с подписью тега — удобно разбирать вставленный текст. `plugins: ['visualblocks']`,\n * `pluginOptions: { visualblocks: { default: true } }` — включить сразу.\n */\n\nconst ICON =\n '<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-dasharray=\"3 3\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"6\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"18\" height=\"6\" rx=\"1\"/></svg>';\nconst LABELS = { en: { title: 'Show blocks' }, ru: { title: 'Показать блоки' } };\n\nexport default definePlugin({\n name: 'visualblocks',\n toolbar: 'visualblocks',\n setup(editor) {\n const { title } = pickLabels(editor, LABELS);\n const options = (editor.options.pluginOptions?.visualblocks ?? {}) as { default?: boolean };\n const isOn = () => editor.root.classList.contains('nova-visualblocks');\n const toggle = () => {\n editor.root.classList.toggle('nova-visualblocks');\n editor.updateUI();\n editor.focus();\n };\n if (options.default) editor.root.classList.add('nova-visualblocks');\n editor.ui.registry.addToggleButton('visualblocks', {\n icon: ICON,\n tooltip: title,\n isActive: isOn,\n onAction: toggle,\n });\n editor.ui.registry.addToggleMenuItem('visualblocks', {\n text: title,\n icon: ICON,\n isActive: isOn,\n onAction: toggle,\n });\n return () => editor.root.classList.remove('nova-visualblocks');\n },\n});\n"],"mappings":";;;;;;;;;AASA,IAAM,OACJ;AACF,IAAM,SAAS,EAAE,IAAI,EAAE,OAAO,cAAc,GAAG,IAAI,EAAE,OAAO,kFAAiB,EAAE;AAE/E,IAAO,uBAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM,QAAQ;AACZ,UAAM,EAAE,MAAM,IAAI,WAAW,QAAQ,MAAM;AAC3C,UAAM,UAAW,OAAO,QAAQ,eAAe,gBAAgB,CAAC;AAChE,UAAM,OAAO,MAAM,OAAO,KAAK,UAAU,SAAS,mBAAmB;AACrE,UAAM,SAAS,MAAM;AACnB,aAAO,KAAK,UAAU,OAAO,mBAAmB;AAChD,aAAO,SAAS;AAChB,aAAO,MAAM;AAAA,IACf;AACA,QAAI,QAAQ,QAAS,QAAO,KAAK,UAAU,IAAI,mBAAmB;AAClE,WAAO,GAAG,SAAS,gBAAgB,gBAAgB;AAAA,MACjD,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,MACV,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,GAAG,SAAS,kBAAkB,gBAAgB;AAAA,MACnD,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,MAAM,OAAO,KAAK,UAAU,OAAO,mBAAmB;AAAA,EAC/D;AACF,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novaprose/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "NovaProse: embeddable rich text (WYSIWYG) editor built on ProseMirror. Secure by default, accessible, TinyMCE-compatible plugin and toolbar names.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wysiwyg",
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"sideEffects": [
|
|
28
28
|
"*.css",
|
|
29
|
-
"./src/plugins/index.ts"
|
|
29
|
+
"./src/plugins/index.ts",
|
|
30
|
+
"./dist/index.js",
|
|
31
|
+
"./dist/index.cjs",
|
|
32
|
+
"./dist/chunk-*.js"
|
|
30
33
|
],
|
|
31
34
|
"main": "./dist/index.cjs",
|
|
32
35
|
"module": "./dist/index.js",
|
package/src/style.css
CHANGED
|
@@ -389,6 +389,10 @@
|
|
|
389
389
|
.nova-content {
|
|
390
390
|
flex: 1;
|
|
391
391
|
overflow: auto;
|
|
392
|
+
/* Ширину задаёт страница, а не содержимое: иначе широкая таблица или длинная строка кода
|
|
393
|
+
раздувают весь редактор на узком экране вместо прокрутки внутри. */
|
|
394
|
+
contain: inline-size;
|
|
395
|
+
min-width: 0;
|
|
392
396
|
}
|
|
393
397
|
|
|
394
398
|
.nova-prosemirror {
|
|
@@ -1549,3 +1553,179 @@ html.nova-fullscreen-lock body {
|
|
|
1549
1553
|
visibility: hidden;
|
|
1550
1554
|
}
|
|
1551
1555
|
}
|
|
1556
|
+
|
|
1557
|
+
/* ======================= встроенные плагины ======================= */
|
|
1558
|
+
|
|
1559
|
+
/* charmap, emoticons: панель символов */
|
|
1560
|
+
.nova-symbols {
|
|
1561
|
+
display: flex;
|
|
1562
|
+
flex-direction: column;
|
|
1563
|
+
gap: 8px;
|
|
1564
|
+
width: 300px;
|
|
1565
|
+
max-width: calc(100vw - 32px);
|
|
1566
|
+
padding: 8px;
|
|
1567
|
+
}
|
|
1568
|
+
.nova-symbols-list {
|
|
1569
|
+
max-height: 260px;
|
|
1570
|
+
overflow: auto;
|
|
1571
|
+
}
|
|
1572
|
+
.nova-symbols-title {
|
|
1573
|
+
margin: 6px 0 4px;
|
|
1574
|
+
color: var(--nova-muted);
|
|
1575
|
+
font-size: 12px;
|
|
1576
|
+
}
|
|
1577
|
+
.nova-symbols-grid {
|
|
1578
|
+
display: grid;
|
|
1579
|
+
grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
|
|
1580
|
+
gap: 2px;
|
|
1581
|
+
}
|
|
1582
|
+
.nova-symbols-cell {
|
|
1583
|
+
height: 32px;
|
|
1584
|
+
border: 0;
|
|
1585
|
+
border-radius: 6px;
|
|
1586
|
+
background: transparent;
|
|
1587
|
+
color: var(--nova-fg);
|
|
1588
|
+
font-size: 18px;
|
|
1589
|
+
cursor: pointer;
|
|
1590
|
+
}
|
|
1591
|
+
.nova-symbols-cell:hover {
|
|
1592
|
+
background: var(--nova-hover);
|
|
1593
|
+
}
|
|
1594
|
+
.nova-symbols-cell:focus-visible {
|
|
1595
|
+
outline: 2px solid var(--nova-focus);
|
|
1596
|
+
outline-offset: -2px;
|
|
1597
|
+
}
|
|
1598
|
+
.nova-symbols-empty {
|
|
1599
|
+
padding: 12px;
|
|
1600
|
+
color: var(--nova-muted);
|
|
1601
|
+
text-align: center;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
/* visualblocks: границы блоков с подписью тега */
|
|
1605
|
+
.nova-visualblocks
|
|
1606
|
+
.nova-prosemirror
|
|
1607
|
+
:is(p, h1, h2, h3, h4, h5, h6, blockquote, ul, ol, pre, table) {
|
|
1608
|
+
position: relative;
|
|
1609
|
+
/* Место под подпись тега, чтобы она не наезжала на текст. */
|
|
1610
|
+
padding-top: 12px;
|
|
1611
|
+
outline: 1px dashed var(--nova-border-strong);
|
|
1612
|
+
outline-offset: 2px;
|
|
1613
|
+
}
|
|
1614
|
+
.nova-visualblocks
|
|
1615
|
+
.nova-prosemirror
|
|
1616
|
+
:is(p, h1, h2, h3, h4, h5, h6, blockquote, ul, ol, pre)::before {
|
|
1617
|
+
position: absolute;
|
|
1618
|
+
top: 0;
|
|
1619
|
+
left: 2px;
|
|
1620
|
+
padding: 0 3px;
|
|
1621
|
+
color: var(--nova-subtle);
|
|
1622
|
+
font:
|
|
1623
|
+
500 9px/1.4 ui-monospace,
|
|
1624
|
+
monospace;
|
|
1625
|
+
text-transform: uppercase;
|
|
1626
|
+
pointer-events: none;
|
|
1627
|
+
}
|
|
1628
|
+
.nova-visualblocks .nova-prosemirror p::before {
|
|
1629
|
+
content: 'p';
|
|
1630
|
+
}
|
|
1631
|
+
.nova-visualblocks .nova-prosemirror h1::before {
|
|
1632
|
+
content: 'h1';
|
|
1633
|
+
}
|
|
1634
|
+
.nova-visualblocks .nova-prosemirror h2::before {
|
|
1635
|
+
content: 'h2';
|
|
1636
|
+
}
|
|
1637
|
+
.nova-visualblocks .nova-prosemirror h3::before {
|
|
1638
|
+
content: 'h3';
|
|
1639
|
+
}
|
|
1640
|
+
.nova-visualblocks .nova-prosemirror h4::before {
|
|
1641
|
+
content: 'h4';
|
|
1642
|
+
}
|
|
1643
|
+
.nova-visualblocks .nova-prosemirror h5::before {
|
|
1644
|
+
content: 'h5';
|
|
1645
|
+
}
|
|
1646
|
+
.nova-visualblocks .nova-prosemirror h6::before {
|
|
1647
|
+
content: 'h6';
|
|
1648
|
+
}
|
|
1649
|
+
.nova-visualblocks .nova-prosemirror blockquote::before {
|
|
1650
|
+
content: 'blockquote';
|
|
1651
|
+
}
|
|
1652
|
+
.nova-visualblocks .nova-prosemirror ul::before {
|
|
1653
|
+
content: 'ul';
|
|
1654
|
+
}
|
|
1655
|
+
.nova-visualblocks .nova-prosemirror ol::before {
|
|
1656
|
+
content: 'ol';
|
|
1657
|
+
}
|
|
1658
|
+
.nova-visualblocks .nova-prosemirror pre::before {
|
|
1659
|
+
content: 'pre';
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
/* autoresize: прокрутка внутри области текста, когда достигнута maxHeight */
|
|
1663
|
+
.nova-autoresize .nova-content {
|
|
1664
|
+
overflow-y: auto;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
/* anchor: якорь в тексте — небольшая метка (в HTML это пустой <a id>) */
|
|
1668
|
+
.nova-prosemirror a[id]:not([href]) {
|
|
1669
|
+
display: inline-block;
|
|
1670
|
+
width: 0.7em;
|
|
1671
|
+
height: 1em;
|
|
1672
|
+
margin: 0 1px;
|
|
1673
|
+
vertical-align: -0.1em;
|
|
1674
|
+
border-left: 2px solid var(--nova-accent);
|
|
1675
|
+
border-bottom: 2px solid var(--nova-accent);
|
|
1676
|
+
border-radius: 0 0 0 3px;
|
|
1677
|
+
cursor: pointer;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/* pagebreak: линия разрыва страницы */
|
|
1681
|
+
.nova-prosemirror .nova-pagebreak {
|
|
1682
|
+
height: 0;
|
|
1683
|
+
margin: 1.5em 0;
|
|
1684
|
+
border-top: 2px dashed var(--nova-border-strong);
|
|
1685
|
+
cursor: pointer;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/* media: видео с прозрачным слоем поверх — клик выделяет блок */
|
|
1689
|
+
.nova-media {
|
|
1690
|
+
position: relative;
|
|
1691
|
+
display: inline-block;
|
|
1692
|
+
max-width: 100%;
|
|
1693
|
+
margin: 0.5em 0;
|
|
1694
|
+
line-height: 0;
|
|
1695
|
+
}
|
|
1696
|
+
.nova-media iframe,
|
|
1697
|
+
.nova-media video {
|
|
1698
|
+
max-width: 100%;
|
|
1699
|
+
border: 0;
|
|
1700
|
+
border-radius: 6px;
|
|
1701
|
+
background: var(--nova-toolbar-bg);
|
|
1702
|
+
}
|
|
1703
|
+
.nova-media-overlay {
|
|
1704
|
+
position: absolute;
|
|
1705
|
+
inset: 0;
|
|
1706
|
+
cursor: pointer;
|
|
1707
|
+
}
|
|
1708
|
+
.nova-prosemirror .ProseMirror-selectednode.nova-media,
|
|
1709
|
+
.nova-prosemirror .ProseMirror-selectednode.nova-pagebreak,
|
|
1710
|
+
.nova-prosemirror a[id]:not([href]).ProseMirror-selectednode {
|
|
1711
|
+
outline: 2px solid var(--nova-focus);
|
|
1712
|
+
outline-offset: 2px;
|
|
1713
|
+
}
|
|
1714
|
+
@media print {
|
|
1715
|
+
.nova-prosemirror .nova-pagebreak {
|
|
1716
|
+
border: 0;
|
|
1717
|
+
margin: 0;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/* Составная кнопка (bullist/numlist с advlist): действие + узкая стрелка с вариантами */
|
|
1722
|
+
.nova-tb-split {
|
|
1723
|
+
display: inline-flex;
|
|
1724
|
+
align-items: center;
|
|
1725
|
+
}
|
|
1726
|
+
.nova-tb-split .nova-tb-split-more {
|
|
1727
|
+
width: 16px;
|
|
1728
|
+
min-width: 16px;
|
|
1729
|
+
padding: 0;
|
|
1730
|
+
margin-left: -2px;
|
|
1731
|
+
}
|