open-text-editor-latest 1.0.1
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 +16 -0
- package/dist/index.cjs.js +41 -0
- package/dist/index.es.js +1146 -0
- package/dist/index.umd.js +41 -0
- package/dist/vite.svg +1 -0
- package/docs/PUBLISH.md +27 -0
- package/docs/editor/developer.md +31 -0
- package/package.json +71 -0
- package/src/editor/OpenTextEditor.jsx +1021 -0
- package/src/editor/README.md +15 -0
- package/src/editor/assets/.gitkeep +0 -0
- package/src/editor/index.jsx +4 -0
- package/src/editor/plugins/formatting.js +10 -0
- package/src/editor/plugins/history.js +9 -0
- package/src/editor/plugins/image.js +9 -0
- package/src/editor/plugins/index.js +25 -0
- package/src/editor/plugins/table.js +9 -0
- package/src/editor/styles/editor.css +8 -0
- package/src/editor/tests/.gitkeep +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Editor
|
|
2
|
+
|
|
3
|
+
This folder contains the rich text editor components and utilities.
|
|
4
|
+
|
|
5
|
+
Structure:
|
|
6
|
+
- `Editor.jsx` — main component (placeholder)
|
|
7
|
+
- `index.jsx` — re-exports editor
|
|
8
|
+
- `components/` — UI building blocks
|
|
9
|
+
- `plugins/` — editor plugins (formatting, images, links)
|
|
10
|
+
- `hooks/` — custom hooks
|
|
11
|
+
- `utils/` — helpers
|
|
12
|
+
- `styles/` — CSS
|
|
13
|
+
- `examples/` — example usage
|
|
14
|
+
|
|
15
|
+
Next: choose editor core (contentEditable, Slate, TipTap/ProseMirror, Draft.js).
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// formatting plugin: wires basic format commands into toolbar or shortcuts
|
|
2
|
+
export default function formattingPlugin(editorApi) {
|
|
3
|
+
// editorApi is expected to expose `execCommand` or similar
|
|
4
|
+
return {
|
|
5
|
+
name: 'formatting',
|
|
6
|
+
install(ed) {
|
|
7
|
+
// noop placeholder: real implementation can add buttons or keybindings
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Plugin registry and loader for open-text-editor
|
|
2
|
+
// Plugins should export an `install(editor)` function which receives
|
|
3
|
+
// the editor instance or API and attaches behavior (commands, buttons, handlers).
|
|
4
|
+
|
|
5
|
+
import formattingPlugin from './formatting.js'
|
|
6
|
+
import imagePlugin from './image.js'
|
|
7
|
+
import tablePlugin from './table.js'
|
|
8
|
+
import historyPlugin from './history.js'
|
|
9
|
+
|
|
10
|
+
const builtInPlugins = {
|
|
11
|
+
formatting: formattingPlugin,
|
|
12
|
+
image: imagePlugin,
|
|
13
|
+
table: tablePlugin,
|
|
14
|
+
history: historyPlugin,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getPlugin(name) {
|
|
18
|
+
return builtInPlugins[name]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function listPlugins() {
|
|
22
|
+
return Object.keys(builtInPlugins)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default builtInPlugins
|
|
File without changes
|