@notectl/core 1.0.4 → 1.0.5
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/README.md +51 -148
- package/dist/chunks/AttrRegistry-DTsHyDVA.mjs +16 -0
- package/dist/chunks/AttrRegistry-DTsHyDVA.mjs.map +1 -0
- package/dist/chunks/Commands-DLP85Mp5.mjs +461 -0
- package/dist/chunks/Commands-DLP85Mp5.mjs.map +1 -0
- package/dist/chunks/Document-CI3iCwEP.mjs +177 -0
- package/dist/chunks/Document-CI3iCwEP.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +7 -0
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +1 -0
- package/dist/chunks/NodeResolver-D68ZLXti.mjs +81 -0
- package/dist/chunks/NodeResolver-D68ZLXti.mjs.map +1 -0
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs +8 -0
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -0
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs +15 -0
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +1 -0
- package/dist/chunks/Selection-D5ZjXoB7.mjs +44 -0
- package/dist/chunks/Selection-D5ZjXoB7.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs +7 -0
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs +398 -0
- package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs.map +1 -0
- package/dist/chunks/TypeBrands-C09nE2qO.mjs +27 -0
- package/dist/chunks/TypeBrands-C09nE2qO.mjs.map +1 -0
- package/dist/chunks/color-picker-Csf0wx5a.mjs +5 -0
- package/dist/chunks/color-picker-Csf0wx5a.mjs.map +1 -0
- package/dist/chunks/index-CPPb-Jah.mjs +569 -0
- package/dist/chunks/index-CPPb-Jah.mjs.map +1 -0
- package/dist/commands/Commands.d.ts +71 -0
- package/dist/commands/Commands.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts +9 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -0
- package/dist/decorations/Decoration.d.ts +76 -0
- package/dist/decorations/Decoration.d.ts.map +1 -0
- package/dist/decorations/PositionMapping.d.ts +9 -0
- package/dist/decorations/PositionMapping.d.ts.map +1 -0
- package/dist/editor/Announcer.d.ts +12 -0
- package/dist/editor/Announcer.d.ts.map +1 -0
- package/dist/editor/DocumentParser.d.ts +5 -0
- package/dist/editor/DocumentParser.d.ts.map +1 -0
- package/dist/editor/DocumentSerializer.d.ts +5 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -0
- package/dist/editor/EditorDOM.d.ts +18 -0
- package/dist/editor/EditorDOM.d.ts.map +1 -0
- package/dist/editor/EditorThemeController.d.ts +21 -0
- package/dist/editor/EditorThemeController.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +131 -0
- package/dist/editor/NotectlEditor.d.ts.map +1 -0
- package/dist/editor/styles/base.d.ts +3 -0
- package/dist/editor/styles/base.d.ts.map +1 -0
- package/dist/editor/styles/code-block.d.ts +3 -0
- package/dist/editor/styles/code-block.d.ts.map +1 -0
- package/dist/editor/styles/color-picker.d.ts +3 -0
- package/dist/editor/styles/color-picker.d.ts.map +1 -0
- package/dist/editor/styles/font-select.d.ts +3 -0
- package/dist/editor/styles/font-select.d.ts.map +1 -0
- package/dist/editor/styles/font-size-select.d.ts +3 -0
- package/dist/editor/styles/font-size-select.d.ts.map +1 -0
- package/dist/editor/styles/heading-select.d.ts +3 -0
- package/dist/editor/styles/heading-select.d.ts.map +1 -0
- package/dist/editor/styles/image.d.ts +3 -0
- package/dist/editor/styles/image.d.ts.map +1 -0
- package/dist/editor/styles/list.d.ts +3 -0
- package/dist/editor/styles/list.d.ts.map +1 -0
- package/dist/editor/styles/reduced-motion.d.ts +3 -0
- package/dist/editor/styles/reduced-motion.d.ts.map +1 -0
- package/dist/editor/styles/table.d.ts +3 -0
- package/dist/editor/styles/table.d.ts.map +1 -0
- package/dist/editor/styles/toolbar.d.ts +3 -0
- package/dist/editor/styles/toolbar.d.ts.map +1 -0
- package/dist/editor/styles.d.ts +12 -0
- package/dist/editor/styles.d.ts.map +1 -0
- package/dist/editor/theme/ThemeEngine.d.ts +6 -0
- package/dist/editor/theme/ThemeEngine.d.ts.map +1 -0
- package/dist/editor/theme/ThemeTokens.d.ts +73 -0
- package/dist/editor/theme/ThemeTokens.d.ts.map +1 -0
- package/dist/fonts.d.ts +17 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.mjs +7 -0
- package/dist/fonts.mjs.map +1 -0
- package/dist/index.d.ts +81 -2360
- package/dist/index.d.ts.map +1 -0
- package/dist/input/ClipboardHandler.d.ts +29 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -0
- package/dist/input/InputHandler.d.ts +32 -0
- package/dist/input/InputHandler.d.ts.map +1 -0
- package/dist/input/InputRule.d.ts +9 -0
- package/dist/input/InputRule.d.ts.map +1 -0
- package/dist/input/InternalClipboard.d.ts +23 -0
- package/dist/input/InternalClipboard.d.ts.map +1 -0
- package/dist/input/KeyboardHandler.d.ts +42 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -0
- package/dist/input/Keymap.d.ts +11 -0
- package/dist/input/Keymap.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +38 -0
- package/dist/input/PasteHandler.d.ts.map +1 -0
- package/dist/input/SourceNormalizer.d.ts +7 -0
- package/dist/input/SourceNormalizer.d.ts.map +1 -0
- package/dist/model/AttrRegistry.d.ts +39 -0
- package/dist/model/AttrRegistry.d.ts.map +1 -0
- package/dist/model/BuiltinSpecs.d.ts +4 -0
- package/dist/model/BuiltinSpecs.d.ts.map +1 -0
- package/dist/model/ContentModel.d.ts +12 -0
- package/dist/model/ContentModel.d.ts.map +1 -0
- package/dist/model/ContentSlice.d.ts +17 -0
- package/dist/model/ContentSlice.d.ts.map +1 -0
- package/dist/model/Document.d.ts +127 -0
- package/dist/model/Document.d.ts.map +1 -0
- package/dist/model/HTMLParser.d.ts +36 -0
- package/dist/model/HTMLParser.d.ts.map +1 -0
- package/dist/model/HTMLUtils.d.ts +6 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -0
- package/dist/model/InlineNodeSpec.d.ts +20 -0
- package/dist/model/InlineNodeSpec.d.ts.map +1 -0
- package/dist/model/MarkSpec.d.ts +22 -0
- package/dist/model/MarkSpec.d.ts.map +1 -0
- package/dist/model/NodeResolver.d.ts +36 -0
- package/dist/model/NodeResolver.d.ts.map +1 -0
- package/dist/model/NodeSpec.d.ts +67 -0
- package/dist/model/NodeSpec.d.ts.map +1 -0
- package/dist/model/ParseRule.d.ts +11 -0
- package/dist/model/ParseRule.d.ts.map +1 -0
- package/dist/model/SanitizeConfig.d.ts +9 -0
- package/dist/model/SanitizeConfig.d.ts.map +1 -0
- package/dist/model/Schema.d.ts +17 -0
- package/dist/model/Schema.d.ts.map +1 -0
- package/dist/model/SchemaRegistry.d.ts +81 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -0
- package/dist/model/Selection.d.ts +52 -0
- package/dist/model/Selection.d.ts.map +1 -0
- package/dist/model/TypeBrands.d.ts +28 -0
- package/dist/model/TypeBrands.d.ts.map +1 -0
- package/dist/notectl-core.mjs +2576 -11104
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +6810 -0
- package/dist/notectl-core.umd.js.map +1 -0
- package/dist/plugins/EventBus.d.ts +13 -0
- package/dist/plugins/EventBus.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +85 -0
- package/dist/plugins/Plugin.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +66 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +48 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -0
- package/dist/plugins/alignment/index.d.ts +2 -0
- package/dist/plugins/alignment/index.d.ts.map +1 -0
- package/dist/plugins/alignment.mjs +92 -0
- package/dist/plugins/alignment.mjs.map +1 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +30 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -0
- package/dist/plugins/blockquote/index.d.ts +2 -0
- package/dist/plugins/blockquote/index.d.ts.map +1 -0
- package/dist/plugins/blockquote.mjs +58 -0
- package/dist/plugins/blockquote.mjs.map +1 -0
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts +5 -0
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +135 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -0
- package/dist/plugins/code-block/index.d.ts +2 -0
- package/dist/plugins/code-block/index.d.ts.map +1 -0
- package/dist/plugins/code-block.mjs +6 -0
- package/dist/plugins/code-block.mjs.map +1 -0
- package/dist/plugins/font/FontPlugin.d.ts +85 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -0
- package/dist/plugins/font/StarterFonts.d.ts +10 -0
- package/dist/plugins/font/StarterFonts.d.ts.map +1 -0
- package/dist/plugins/font/index.d.ts +2 -0
- package/dist/plugins/font/index.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts +65 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -0
- package/dist/plugins/font-size/index.d.ts +2 -0
- package/dist/plugins/font-size/index.d.ts.map +1 -0
- package/dist/plugins/font-size.mjs +220 -0
- package/dist/plugins/font-size.mjs.map +1 -0
- package/dist/plugins/font.mjs +186 -0
- package/dist/plugins/font.mjs.map +1 -0
- package/dist/plugins/hard-break/HardBreakPlugin.d.ts +16 -0
- package/dist/plugins/hard-break/HardBreakPlugin.d.ts.map +1 -0
- package/dist/plugins/hard-break/index.d.ts +2 -0
- package/dist/plugins/hard-break/index.d.ts.map +1 -0
- package/dist/plugins/hard-break.mjs +28 -0
- package/dist/plugins/hard-break.mjs.map +1 -0
- package/dist/plugins/heading/BlockTypePickerEntry.d.ts +20 -0
- package/dist/plugins/heading/BlockTypePickerEntry.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts +78 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -0
- package/dist/plugins/heading/index.d.ts +3 -0
- package/dist/plugins/heading/index.d.ts.map +1 -0
- package/dist/plugins/heading.mjs +188 -0
- package/dist/plugins/heading.mjs.map +1 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts +37 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -0
- package/dist/plugins/highlight/index.d.ts +2 -0
- package/dist/plugins/highlight/index.d.ts.map +1 -0
- package/dist/plugins/highlight.mjs +126 -0
- package/dist/plugins/highlight.mjs.map +1 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +29 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/index.d.ts +2 -0
- package/dist/plugins/horizontal-rule/index.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule.mjs +59 -0
- package/dist/plugins/horizontal-rule.mjs.map +1 -0
- package/dist/plugins/image/ImageCommands.d.ts +26 -0
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -0
- package/dist/plugins/image/ImageNodeView.d.ts +6 -0
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts +43 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -0
- package/dist/plugins/image/ImageUpload.d.ts +48 -0
- package/dist/plugins/image/ImageUpload.d.ts.map +1 -0
- package/dist/plugins/image/index.d.ts +3 -0
- package/dist/plugins/image/index.d.ts.map +1 -0
- package/dist/plugins/image.mjs +381 -0
- package/dist/plugins/image.mjs.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +32 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -0
- package/dist/plugins/link/index.d.ts +2 -0
- package/dist/plugins/link/index.d.ts.map +1 -0
- package/dist/plugins/link.mjs +127 -0
- package/dist/plugins/link.mjs.map +1 -0
- package/dist/plugins/list/ListPlugin.d.ts +51 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -0
- package/dist/plugins/list/index.d.ts +2 -0
- package/dist/plugins/list/index.d.ts.map +1 -0
- package/dist/plugins/list.mjs +193 -0
- package/dist/plugins/list.mjs.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +23 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -0
- package/dist/plugins/strikethrough/index.d.ts +2 -0
- package/dist/plugins/strikethrough/index.d.ts.map +1 -0
- package/dist/plugins/strikethrough.mjs +35 -0
- package/dist/plugins/strikethrough.mjs.map +1 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts +44 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -0
- package/dist/plugins/super-sub/index.d.ts +2 -0
- package/dist/plugins/super-sub/index.d.ts.map +1 -0
- package/dist/plugins/super-sub.mjs +81 -0
- package/dist/plugins/super-sub.mjs.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts +50 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -0
- package/dist/plugins/table/TableControls.d.ts +10 -0
- package/dist/plugins/table/TableControls.d.ts.map +1 -0
- package/dist/plugins/table/TableControlsDOM.d.ts +18 -0
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -0
- package/dist/plugins/table/TableControlsLayout.d.ts +34 -0
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -0
- package/dist/plugins/table/TableHelpers.d.ts +39 -0
- package/dist/plugins/table/TableHelpers.d.ts.map +1 -0
- package/dist/plugins/table/TableNavigation.d.ts +4 -0
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -0
- package/dist/plugins/table/TableNodeViews.d.ts +18 -0
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -0
- package/dist/plugins/table/TablePlugin.d.ts +39 -0
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -0
- package/dist/plugins/table/TableSelection.d.ts +26 -0
- package/dist/plugins/table/TableSelection.d.ts.map +1 -0
- package/dist/plugins/table/TableTestUtils.d.ts +45 -0
- package/dist/plugins/table/TableTestUtils.d.ts.map +1 -0
- package/dist/plugins/table/index.d.ts +4 -0
- package/dist/plugins/table/index.d.ts.map +1 -0
- package/dist/plugins/table.mjs +663 -0
- package/dist/plugins/table.mjs.map +1 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts +37 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -0
- package/dist/plugins/text-color/index.d.ts +2 -0
- package/dist/plugins/text-color/index.d.ts.map +1 -0
- package/dist/plugins/text-color.mjs +126 -0
- package/dist/plugins/text-color.mjs.map +1 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +34 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -0
- package/dist/plugins/text-formatting/index.d.ts +2 -0
- package/dist/plugins/text-formatting/index.d.ts.map +1 -0
- package/dist/plugins/text-formatting.mjs +52 -0
- package/dist/plugins/text-formatting.mjs.map +1 -0
- package/dist/plugins/toolbar/ToolbarItem.d.ts +66 -0
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts +25 -0
- package/dist/plugins/toolbar/ToolbarKeyboardNav.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +47 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +25 -0
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts +19 -0
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts +17 -0
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -0
- package/dist/plugins/toolbar/index.d.ts +4 -0
- package/dist/plugins/toolbar/index.d.ts.map +1 -0
- package/dist/plugins/toolbar.mjs +8 -0
- package/dist/plugins/toolbar.mjs.map +1 -0
- package/dist/state/EditorState.d.ts +40 -0
- package/dist/state/EditorState.d.ts.map +1 -0
- package/dist/state/History.d.ts +38 -0
- package/dist/state/History.d.ts.map +1 -0
- package/dist/state/StepApplication.d.ts +5 -0
- package/dist/state/StepApplication.d.ts.map +1 -0
- package/dist/state/Transaction.d.ts +185 -0
- package/dist/state/Transaction.d.ts.map +1 -0
- package/dist/test/PluginTestUtils.d.ts +127 -0
- package/dist/test/PluginTestUtils.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts +153 -0
- package/dist/test/TestUtils.d.ts.map +1 -0
- package/dist/view/EditorView.d.ts +74 -0
- package/dist/view/EditorView.d.ts.map +1 -0
- package/dist/view/NodeView.d.ts +18 -0
- package/dist/view/NodeView.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +23 -0
- package/dist/view/Reconciler.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts +8 -0
- package/dist/view/SelectionSync.d.ts.map +1 -0
- package/package.json +112 -11
- package/dist/notectl-core.js +0 -1463
- package/dist/notectl-core.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# notectl
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### The rich text editor that gets out of your way.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A modular, accessible rich text editor — shipped as a Web Component.
|
|
8
|
+
Use what you need, nothing more.
|
|
8
9
|
|
|
9
10
|
[](https://www.typescriptlang.org/)
|
|
10
11
|
[](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
|
|
@@ -15,42 +16,34 @@ Built on immutable state, a transaction-based architecture, and a plugin system
|
|
|
15
16
|
|
|
16
17
|
<img src="docs-site/src/assets/screenshots/hero-editor-rich.png" alt="notectl editor with rich content" width="720" />
|
|
17
18
|
|
|
19
|
+
[Documentation](https://samyssmile.github.io/notectl/) • [Playground](https://samyssmile.github.io/notectl/playground/) • [npm](https://www.npmjs.com/package/@notectl/core)
|
|
20
|
+
|
|
18
21
|
</div>
|
|
19
22
|
|
|
20
23
|
<br />
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
**Try it live** — [Open the playground](https://samyssmile.github.io/notectl/playground/) (no install required)
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
<br />
|
|
28
|
+
|
|
29
|
+
## Why notectl?
|
|
25
30
|
|
|
26
|
-
- **Web Component** — drop `<notectl-editor>` into
|
|
27
|
-
- **Plugin architecture** — every feature
|
|
31
|
+
- **Web Component** — drop `<notectl-editor>` into React, Vue, Svelte, Angular, or plain HTML
|
|
32
|
+
- **Plugin architecture** — every feature is a plugin; add only what you need
|
|
33
|
+
- **Accessible by default** — full keyboard navigation, ARIA roles and labels, screen reader support
|
|
28
34
|
- **Immutable state** — predictable updates, time-travel undo/redo, zero mutation bugs
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **Tiny dependency footprint** — single runtime dependency (DOMPurify)
|
|
35
|
+
- **Native Angular integration** — available as [`@notectl/angular`](https://www.npmjs.com/package/@notectl/angular)
|
|
36
|
+
- **Lightweight** — bundle size of notectl core is 29kb
|
|
37
|
+
- **Single dependency** — only DOMPurify at runtime
|
|
33
38
|
|
|
34
39
|
<br />
|
|
35
40
|
|
|
36
|
-
## Wanna try?
|
|
37
|
-
Check out the [live playground](https://samyssmile.github.io/notectl/playground/) — no install required.
|
|
38
|
-
|
|
39
|
-
## Wanna see full working example?
|
|
40
|
-
`examples/vanillajs/` is a great place to see everything in action.
|
|
41
|
-
`examples/angular/` shows how to use notectl in Angular with the `@notectl/angular` package.
|
|
42
|
-
|
|
43
41
|
## Quick Start
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
### Install
|
|
47
|
-
|
|
48
43
|
```bash
|
|
49
44
|
npm install @notectl/core
|
|
50
45
|
```
|
|
51
46
|
|
|
52
|
-
### Use
|
|
53
|
-
|
|
54
47
|
```ts
|
|
55
48
|
import {
|
|
56
49
|
createEditor,
|
|
@@ -77,17 +70,30 @@ const editor = await createEditor({
|
|
|
77
70
|
document.body.appendChild(editor);
|
|
78
71
|
```
|
|
79
72
|
|
|
80
|
-
|
|
73
|
+
A full-featured editor in 16 lines.
|
|
74
|
+
|
|
75
|
+
<br />
|
|
76
|
+
|
|
77
|
+
## Accessibility
|
|
78
|
+
|
|
79
|
+
notectl is built with accessibility as a first-class concern, not an afterthought.
|
|
80
|
+
|
|
81
|
+
- Full **keyboard navigation** — every feature reachable without a mouse
|
|
82
|
+
- Semantic **ARIA roles and labels** on all interactive elements
|
|
83
|
+
- Proper **focus management** across toolbar, dialogs, and editor content
|
|
84
|
+
- **Screen reader** friendly — announces formatting changes and editor state
|
|
85
|
+
- **High-contrast** compatible with `ThemePreset.Light` and `ThemePreset.Dark`
|
|
81
86
|
|
|
82
87
|
<br />
|
|
83
88
|
|
|
84
89
|
## Plugins
|
|
85
90
|
|
|
86
91
|
Every capability is a plugin. Compose exactly the editor you need.
|
|
92
|
+
See the [plugin documentation](https://samyssmile.github.io/notectl/) for configuration details and examples.
|
|
87
93
|
|
|
88
94
|
| Plugin | What it does |
|
|
89
95
|
|---|---|
|
|
90
|
-
| **TextFormattingPlugin** | Bold, italic, underline
|
|
96
|
+
| **TextFormattingPlugin** | Bold, italic, underline |
|
|
91
97
|
| **StrikethroughPlugin** | ~~Strikethrough~~ text |
|
|
92
98
|
| **HeadingPlugin** | H1 – H6 headings |
|
|
93
99
|
| **BlockquotePlugin** | Block quotes |
|
|
@@ -95,158 +101,55 @@ Every capability is a plugin. Compose exactly the editor you need.
|
|
|
95
101
|
| **LinkPlugin** | Hyperlink insertion and editing |
|
|
96
102
|
| **TablePlugin** | Full table support with row/column controls |
|
|
97
103
|
| **TextColorPlugin** | Text color picker |
|
|
104
|
+
| **HighlightPlugin** | Text highlighting / background color |
|
|
98
105
|
| **AlignmentPlugin** | Left, center, right, justify |
|
|
99
|
-
| **FontPlugin** | Font family selection with custom
|
|
106
|
+
| **FontPlugin** | Font family selection with custom fonts |
|
|
100
107
|
| **FontSizePlugin** | Configurable font sizes |
|
|
101
108
|
| **HorizontalRulePlugin** | Horizontal dividers |
|
|
102
109
|
| **SuperSubPlugin** | Superscript and subscript |
|
|
103
|
-
| **HighlightPlugin** | Text highlighting / background color |
|
|
104
|
-
| **ToolbarPlugin** | Visual toolbar with grouped items |
|
|
105
|
-
|
|
106
|
-
### Tables
|
|
107
|
-
|
|
108
|
-
Full table editing — add/remove rows and columns, navigate with Tab, resize, and select.
|
|
109
|
-
|
|
110
|
-
<div align="center">
|
|
111
|
-
<img src="docs-site/src/assets/screenshots/editor-table-showcase.png" alt="Table editing in notectl" width="720" />
|
|
112
|
-
</div>
|
|
113
110
|
|
|
114
111
|
<br />
|
|
115
112
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
Read and write content in multiple formats:
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
// JSON (immutable Document)
|
|
122
|
-
const doc = editor.getJSON();
|
|
123
|
-
editor.setJSON(doc);
|
|
124
|
-
|
|
125
|
-
// HTML (sanitized via DOMPurify)
|
|
126
|
-
const html = editor.getHTML();
|
|
127
|
-
editor.setHTML('<p>Hello <strong>world</strong></p>');
|
|
128
|
-
|
|
129
|
-
// Plain text
|
|
130
|
-
const text = editor.getText();
|
|
131
|
-
|
|
132
|
-
// State
|
|
133
|
-
editor.isEmpty(); // true | false
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Command API
|
|
113
|
+
## Full Working Examples
|
|
137
114
|
|
|
138
|
-
|
|
139
|
-
editor.commands.toggleBold();
|
|
140
|
-
editor.commands.toggleItalic();
|
|
141
|
-
editor.commands.toggleUnderline();
|
|
142
|
-
editor.commands.undo();
|
|
143
|
-
editor.commands.redo();
|
|
144
|
-
editor.commands.selectAll();
|
|
145
|
-
```
|
|
115
|
+
See notectl in action with every plugin, custom fonts, and the complete API:
|
|
146
116
|
|
|
147
|
-
|
|
117
|
+
- [`examples/vanillajs`](examples/vanillajs) — Vanilla JavaScript
|
|
118
|
+
- [`examples/angular`](examples/angular) — Angular with `@notectl/angular`
|
|
148
119
|
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
editor.on('ready', () => { /* ... */ });
|
|
153
|
-
editor.on('focus', () => { /* ... */ });
|
|
154
|
-
editor.on('blur', () => { /* ... */ });
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
<br />
|
|
158
|
-
|
|
159
|
-
## Custom Fonts
|
|
160
|
-
|
|
161
|
-
Bring your own fonts — notectl handles `@font-face` injection automatically.
|
|
162
|
-
|
|
163
|
-
```ts
|
|
164
|
-
import { FontPlugin, STARTER_FONTS } from '@notectl/core';
|
|
165
|
-
|
|
166
|
-
const Inter = {
|
|
167
|
-
name: 'Inter',
|
|
168
|
-
family: "'Inter', sans-serif",
|
|
169
|
-
category: 'sans-serif',
|
|
170
|
-
fontFaces: [
|
|
171
|
-
{
|
|
172
|
-
src: "url('/fonts/Inter-Variable.ttf') format('truetype')",
|
|
173
|
-
weight: '100 900',
|
|
174
|
-
style: 'normal',
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
new FontPlugin({ fonts: [...STARTER_FONTS, Inter] });
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/Samyssmile/notectl.git
|
|
122
|
+
cd notectl && pnpm install && pnpm dev
|
|
180
123
|
```
|
|
181
124
|
|
|
182
125
|
<br />
|
|
183
126
|
|
|
184
|
-
##
|
|
185
|
-
|
|
186
|
-
Group plugins into toolbar sections for a clean UI:
|
|
127
|
+
## Content API
|
|
187
128
|
|
|
188
129
|
```ts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
[new AlignmentPlugin()],
|
|
195
|
-
[new ListPlugin()],
|
|
196
|
-
[new LinkPlugin(), new TablePlugin(), new HorizontalRulePlugin()],
|
|
197
|
-
],
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Each inner array becomes a visually separated group in the toolbar.
|
|
202
|
-
|
|
203
|
-
<br />
|
|
204
|
-
|
|
205
|
-
## Examples
|
|
206
|
-
|
|
207
|
-
Check out the full working example in [`examples/vanillajs`](examples/vanillajs) — it demonstrates every plugin, custom font loading, toolbar grouping, and the complete content API.
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
git clone https://github.com/Samyssmile/notectl.git
|
|
211
|
-
cd notectl
|
|
212
|
-
pnpm install
|
|
213
|
-
pnpm dev
|
|
130
|
+
editor.getHTML(); // read HTML
|
|
131
|
+
editor.setHTML('<p>Hello <strong>world</strong></p>'); // write HTML
|
|
132
|
+
editor.getJSON(); // read JSON
|
|
133
|
+
editor.getText(); // read plain text
|
|
134
|
+
editor.isEmpty(); // check if empty
|
|
214
135
|
```
|
|
215
136
|
|
|
216
137
|
<br />
|
|
217
138
|
|
|
218
|
-
##
|
|
139
|
+
## Documentation
|
|
219
140
|
|
|
220
|
-
|
|
221
|
-
Input Event → InputHandler / KeyboardHandler
|
|
222
|
-
→ Transaction with atomic Steps
|
|
223
|
-
→ Middleware chain (priority-ordered)
|
|
224
|
-
→ EditorState.apply(tr) → new immutable EditorState
|
|
225
|
-
→ Reconciler patches DOM (block-level diffing)
|
|
226
|
-
→ Plugins notified via onStateChange()
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
| Layer | Responsibility |
|
|
230
|
-
|---|---|
|
|
231
|
-
| `model/` | Immutable data — Document, BlockNode, TextNode, Mark, Selection |
|
|
232
|
-
| `state/` | EditorState, Transaction, StepApplication, History |
|
|
233
|
-
| `view/` | DOM rendering, Reconciler, SelectionSync |
|
|
234
|
-
| `input/` | Keyboard/input handling, paste, input rules |
|
|
235
|
-
| `commands/` | High-level operations (toggleMark, splitBlock, ...) |
|
|
236
|
-
| `plugins/` | All features — every capability is a plugin |
|
|
237
|
-
| `editor/` | `<notectl-editor>` Web Component public API |
|
|
141
|
+
Full guides, API reference, and plugin docs are available at **[samyssmile.github.io/notectl](https://samyssmile.github.io/notectl/)**.
|
|
238
142
|
|
|
239
143
|
<br />
|
|
240
144
|
|
|
241
|
-
##
|
|
145
|
+
## Contributing
|
|
242
146
|
|
|
243
147
|
```bash
|
|
244
148
|
pnpm install # install dependencies
|
|
245
149
|
pnpm build # build all packages
|
|
246
|
-
pnpm test # run unit tests
|
|
247
|
-
pnpm test:e2e # run e2e tests
|
|
248
|
-
pnpm lint # lint
|
|
249
|
-
pnpm typecheck # type check
|
|
150
|
+
pnpm test # run unit tests
|
|
151
|
+
pnpm test:e2e # run e2e tests
|
|
152
|
+
pnpm lint # lint
|
|
250
153
|
```
|
|
251
154
|
|
|
252
155
|
<br />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { i as n } from "./Document-CI3iCwEP.mjs";
|
|
2
|
+
function t(n2, t2) {
|
|
3
|
+
return n2.type === t2;
|
|
4
|
+
}
|
|
5
|
+
function e(n2, t2) {
|
|
6
|
+
return n2.type === t2;
|
|
7
|
+
}
|
|
8
|
+
function r(t2, e2) {
|
|
9
|
+
return n(t2) && t2.inlineType === e2;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
r as a,
|
|
13
|
+
e as b,
|
|
14
|
+
t as i
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=AttrRegistry-DTsHyDVA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttrRegistry-DTsHyDVA.mjs","sources":["../../src/model/AttrRegistry.ts"],"sourcesContent":["/**\n * Module-augmentable attribute registries for type-safe node/mark attributes.\n *\n * Plugins extend these interfaces via `declare module`:\n * @example\n * declare module '../../model/AttrRegistry.js' {\n * interface NodeAttrRegistry {\n * heading: { level: HeadingLevel; align?: BlockAlignment };\n * }\n * }\n */\n\nimport type { BlockAlignment } from '../plugins/alignment/AlignmentPlugin.js';\nimport type { BlockNode, InlineNode, Mark } from './Document.js';\nimport { isInlineNode } from './Document.js';\n\n/** Plugins augment this interface to register typed node attributes. */\nexport interface NodeAttrRegistry {\n\tparagraph: { align?: BlockAlignment };\n}\n\n/** Plugins augment this interface to register typed mark attributes. */\nexport interface MarkAttrRegistry {\n\tbold: Record<string, never>;\n\titalic: Record<string, never>;\n\tunderline: Record<string, never>;\n}\n\n/** Resolves typed attributes for known node types, falls back for unknown. */\nexport type NodeAttrsFor<T extends string> = T extends keyof NodeAttrRegistry\n\t? NodeAttrRegistry[T]\n\t: Record<string, string | number | boolean>;\n\n/** Resolves typed attributes for known mark types, falls back for unknown. */\nexport type MarkAttrsFor<T extends string> = T extends keyof MarkAttrRegistry\n\t? MarkAttrRegistry[T]\n\t: Record<string, string | number | boolean>;\n\n/** Narrows a BlockNode to a typed variant with known attributes. */\nexport function isNodeOfType<T extends keyof NodeAttrRegistry>(\n\tnode: BlockNode,\n\ttype: T,\n): node is BlockNode & { readonly type: T; readonly attrs: NodeAttrRegistry[T] } {\n\treturn (node.type as string) === type;\n}\n\n/** Narrows a Mark to a typed variant with known attributes. */\nexport function isMarkOfType<T extends keyof MarkAttrRegistry>(\n\tmark: Mark,\n\ttype: T,\n): mark is Mark & { readonly type: T; readonly attrs: MarkAttrRegistry[T] } {\n\treturn (mark.type as string) === type;\n}\n\n// --- InlineNode Attribute Registry ---\n\n/** Plugins augment this interface to register typed inline node attributes. */\n// biome-ignore lint/suspicious/noEmptyInterface: module augmentation requires interface\nexport interface InlineNodeAttrRegistry {}\n\n/** Resolves typed attributes for known inline node types, falls back for unknown. */\nexport type InlineNodeAttrsFor<T extends string> = T extends keyof InlineNodeAttrRegistry\n\t? InlineNodeAttrRegistry[T]\n\t: Record<string, string | number | boolean>;\n\n/** Narrows an InlineNode to a typed variant with known attributes. */\nexport function isInlineNodeOfType<T extends keyof InlineNodeAttrRegistry>(\n\tnode: InlineNode,\n\tinlineNodeType: T,\n): node is InlineNode & {\n\treadonly inlineType: T;\n\treadonly attrs: InlineNodeAttrRegistry[T];\n} {\n\treturn isInlineNode(node) && (node.inlineType as string) === inlineNodeType;\n}\n"],"names":["isNodeOfType","node","type","isMarkOfType","mark","isInlineNodeOfType","inlineNodeType","isInlineNode","inlineType"],"mappings":";AAuCO,SAASA,EACfC,IACAC,IAAAA;AAEA,SAAQD,GAAKC,SAAoBA;AAClC;AAGO,SAASC,EACfC,IACAF,IAAAA;AAEA,SAAQE,GAAKF,SAAoBA;AAClC;AAcO,SAASG,EACfJ,IACAK,IAAAA;AAKA,SAAOC,EAAaN,EAAAA,KAAUA,GAAKO,eAA0BF;AAC9D;"}
|