open-text-editor-latest 1.0.2 → 1.0.6
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/LICENSE +21 -0
- package/docs/PUBLISH.md +31 -31
- package/docs/USAGE.md +81 -81
- package/docs/editor/developer.md +37 -37
- package/package.json +1 -1
- package/src/editor/OpenTextEditor.jsx +1020 -1020
- package/src/editor/README.md +15 -15
- package/src/editor/index.jsx +3 -3
- package/src/editor/plugins/formatting.js +10 -10
- package/src/editor/plugins/history.js +9 -9
- package/src/editor/plugins/image.js +9 -9
- package/src/editor/plugins/index.js +25 -25
- package/src/editor/plugins/table.js +9 -9
- package/src/editor/styles/editor.css +8 -8
package/src/editor/README.md
CHANGED
|
@@ -1,15 +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).
|
|
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).
|
package/src/editor/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import OpenTextEditor from './OpenTextEditor.jsx';
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
import OpenTextEditor from './OpenTextEditor.jsx';
|
|
3
|
+
|
|
4
4
|
export default OpenTextEditor;
|
|
@@ -1,10 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// history plugin: undo/redo stack management
|
|
2
|
-
export default function historyPlugin(editorApi) {
|
|
3
|
-
return {
|
|
4
|
-
name: 'history',
|
|
5
|
-
install(ed) {
|
|
6
|
-
// placeholder for history management
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
// history plugin: undo/redo stack management
|
|
2
|
+
export default function historyPlugin(editorApi) {
|
|
3
|
+
return {
|
|
4
|
+
name: 'history',
|
|
5
|
+
install(ed) {
|
|
6
|
+
// placeholder for history management
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// image plugin: handle image upload, resize and alignment helpers
|
|
2
|
-
export default function imagePlugin(editorApi) {
|
|
3
|
-
return {
|
|
4
|
-
name: 'image',
|
|
5
|
-
install(ed) {
|
|
6
|
-
// placeholder for image-related features
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
// image plugin: handle image upload, resize and alignment helpers
|
|
2
|
+
export default function imagePlugin(editorApi) {
|
|
3
|
+
return {
|
|
4
|
+
name: 'image',
|
|
5
|
+
install(ed) {
|
|
6
|
+
// placeholder for image-related features
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,25 +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
|
|
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
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// table plugin: insert table helper
|
|
2
|
-
export default function tablePlugin(editorApi) {
|
|
3
|
-
return {
|
|
4
|
-
name: 'table',
|
|
5
|
-
install(ed) {
|
|
6
|
-
// placeholder for table insertion and editing
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
// table plugin: insert table helper
|
|
2
|
+
export default function tablePlugin(editorApi) {
|
|
3
|
+
return {
|
|
4
|
+
name: 'table',
|
|
5
|
+
install(ed) {
|
|
6
|
+
// placeholder for table insertion and editing
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
.rte-root {
|
|
2
|
-
min-height: 200px;
|
|
3
|
-
border: 1px solid #ccc;
|
|
4
|
-
padding: 12px;
|
|
5
|
-
border-radius: 6px;
|
|
6
|
-
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
|
7
|
-
outline: none;
|
|
8
|
-
}
|
|
1
|
+
.rte-root {
|
|
2
|
+
min-height: 200px;
|
|
3
|
+
border: 1px solid #ccc;
|
|
4
|
+
padding: 12px;
|
|
5
|
+
border-radius: 6px;
|
|
6
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
|
7
|
+
outline: none;
|
|
8
|
+
}
|