smartrte-react 0.1.18 → 0.2.2

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.
Files changed (46) hide show
  1. package/README.md +83 -15
  2. package/dist/components/ClassicEditor.d.ts +32 -1
  3. package/dist/components/ClassicEditor.js +949 -251
  4. package/dist/components/MediaManager.d.ts +7 -0
  5. package/dist/components/MediaManager.js +85 -29
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +1 -0
  8. package/dist/standalone/classic-editor-embed.js +1 -1
  9. package/dist/theme.d.ts +3 -0
  10. package/dist/theme.js +78 -0
  11. package/package.json +13 -12
  12. package/dist/QuillEditor.d.ts +0 -8
  13. package/dist/QuillEditor.js +0 -34
  14. package/dist/app.d.ts +0 -6
  15. package/dist/app.js +0 -6
  16. package/dist/blots/CommentBlot.d.ts +0 -8
  17. package/dist/blots/CommentBlot.js +0 -17
  18. package/dist/blots/FormulaBlot.d.ts +0 -12
  19. package/dist/blots/FormulaBlot.js +0 -36
  20. package/dist/blots/MediaBlot.d.ts +0 -11
  21. package/dist/blots/MediaBlot.js +0 -37
  22. package/dist/blots/TableBlot.d.ts +0 -10
  23. package/dist/blots/TableBlot.js +0 -54
  24. package/dist/blots/index.d.ts +0 -5
  25. package/dist/blots/index.js +0 -12
  26. package/dist/components/DiagramEditor.d.ts +0 -5
  27. package/dist/components/DiagramEditor.js +0 -73
  28. package/dist/components/FormulaEditor.d.ts +0 -6
  29. package/dist/components/FormulaEditor.js +0 -86
  30. package/dist/components/InfoBox.d.ts +0 -7
  31. package/dist/components/InfoBox.js +0 -18
  32. package/dist/components/MCQBlock.d.ts +0 -13
  33. package/dist/components/MCQBlock.js +0 -29
  34. package/dist/components/SmartEditor.d.ts +0 -0
  35. package/dist/components/SmartEditor.js +0 -1
  36. package/dist/components/SmartTable.d.ts +0 -22
  37. package/dist/components/SmartTable.js +0 -629
  38. package/dist/components/TableContextMenu.d.ts +0 -11
  39. package/dist/components/TableContextMenu.js +0 -15
  40. package/dist/components/TableInsertDialog.d.ts +0 -7
  41. package/dist/components/TableInsertDialog.js +0 -42
  42. package/dist/hooks/useEditorSync.d.ts +0 -5
  43. package/dist/hooks/useEditorSync.js +0 -53
  44. package/dist/smart-editor.d.ts +0 -0
  45. package/dist/smart-editor.js +0 -1
  46. package/dist/standalone/editor.js +0 -241
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- export const TableInsertDialog = ({ onInsert, onClose, }) => {
4
- const [hoverRows, setHoverRows] = useState(0);
5
- const [hoverCols, setHoverCols] = useState(0);
6
- const maxRows = 10;
7
- const maxCols = 10;
8
- return (_jsxs("div", { style: {
9
- position: "absolute",
10
- top: 60,
11
- left: 100,
12
- background: "#fff",
13
- border: "1px solid #ddd",
14
- padding: 12,
15
- zIndex: 1000,
16
- boxShadow: "0 4px 10px rgba(0,0,0,0.15)",
17
- }, children: [_jsx("div", { style: {
18
- display: "grid",
19
- gridTemplateColumns: `repeat(${maxCols}, 20px)`,
20
- gap: 4,
21
- }, children: Array.from({ length: maxRows }).map((_, r) => Array.from({ length: maxCols }).map((_, c) => {
22
- const active = r < hoverRows && c < hoverCols;
23
- return (_jsx("div", { style: {
24
- width: 20,
25
- height: 20,
26
- border: "1px solid #ccc",
27
- background: active ? "#3399ff" : "#f9f9f9",
28
- cursor: "pointer",
29
- }, onMouseEnter: () => {
30
- setHoverRows(r + 1);
31
- setHoverCols(c + 1);
32
- }, onClick: () => {
33
- onInsert(r + 1, c + 1);
34
- onClose();
35
- } }, `${r}-${c}`));
36
- })) }), _jsxs("div", { style: { marginTop: 8, textAlign: "center", fontSize: 12 }, children: [hoverRows, " \u00D7 ", hoverCols] }), _jsx("button", { style: {
37
- marginTop: 8,
38
- padding: "4px 8px",
39
- fontSize: 12,
40
- cursor: "pointer",
41
- }, onClick: onClose, children: "Cancel" })] }));
42
- };
@@ -1,5 +0,0 @@
1
- export declare function useEditorSync(editor: any): {
2
- doc: any;
3
- setDoc: import("react").Dispatch<any>;
4
- sync: () => void;
5
- };
@@ -1,53 +0,0 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
2
- export function useEditorSync(editor) {
3
- const [doc, setDoc] = useState({ nodes: [] });
4
- const retryRef = useRef(null);
5
- const sync = useCallback(() => {
6
- if (!editor)
7
- return;
8
- // Skip if the wasm Editor was freed (HMR/unmount). __wbg_ptr === 0 means invalid.
9
- try {
10
- if (typeof editor.__wbg_ptr === 'number' && editor.__wbg_ptr === 0)
11
- return;
12
- }
13
- catch { }
14
- // Defer to next tick to avoid wasm RefCell re-entrancy when calling
15
- // multiple &mut self methods back-to-back in the same event loop turn.
16
- setTimeout(() => {
17
- try {
18
- if (typeof editor.__wbg_ptr === 'number' && editor.__wbg_ptr === 0)
19
- return;
20
- const json = editor.to_json();
21
- const parsed = JSON.parse(json);
22
- setDoc(parsed);
23
- }
24
- catch (err) {
25
- // Avoid noisy logs during HMR/refresh when wasm may be temporarily invalid
26
- // Retry once shortly after in case module just reloaded
27
- if (retryRef.current)
28
- window.clearTimeout(retryRef.current);
29
- retryRef.current = window.setTimeout(() => {
30
- try {
31
- if (typeof editor.__wbg_ptr === 'number' && editor.__wbg_ptr !== 0) {
32
- const j = editor.to_json();
33
- setDoc(JSON.parse(j));
34
- }
35
- }
36
- catch { }
37
- retryRef.current = null;
38
- }, 100);
39
- }
40
- }, 0);
41
- }, [editor]);
42
- useEffect(() => {
43
- if (!editor)
44
- return;
45
- try {
46
- if (typeof editor.__wbg_ptr === 'number' && editor.__wbg_ptr === 0)
47
- return;
48
- }
49
- catch { }
50
- sync();
51
- }, [editor, sync]);
52
- return { doc, setDoc, sync };
53
- }
File without changes
@@ -1 +0,0 @@
1
- // Removed: SmartEditor shim no longer needed