@portone/docx-editor 0.1.1 → 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/CHANGELOG.md +17 -0
- package/README.md +17 -5
- package/dist/DocxEditor.d.ts +34 -10
- package/dist/DocxEditor.js +69 -24
- package/dist/core.d.ts +2 -0
- package/dist/core.js +2 -0
- package/dist/docx/commentOnlyChange.d.ts +45 -0
- package/dist/docx/commentOnlyChange.js +145 -0
- package/dist/docx/comments/constants.d.ts +8 -0
- package/dist/docx/comments/constants.js +6 -0
- package/dist/docx/comments/contentTypes.d.ts +7 -0
- package/dist/docx/comments/contentTypes.js +38 -0
- package/dist/docx/comments/model.d.ts +2 -0
- package/dist/docx/comments/model.js +3 -0
- package/dist/docx/comments/people.d.ts +39 -0
- package/dist/docx/comments/people.js +198 -0
- package/dist/docx/comments/reading.d.ts +16 -1
- package/dist/docx/comments/reading.js +15 -5
- package/dist/docx/comments/writing.d.ts +4 -1
- package/dist/docx/comments/writing.js +12 -32
- package/dist/docx/importParagraph.js +1 -0
- package/dist/editor/commands/breakCommands.js +4 -1
- package/dist/editor/commands/canRunCommand.d.ts +3 -2
- package/dist/editor/commands/canRunCommand.js +1 -1
- package/dist/editor/commands/comments/editing.js +6 -4
- package/dist/editor/commands/comments/model.d.ts +9 -0
- package/dist/editor/commands/comments/reading.d.ts +7 -0
- package/dist/editor/commands/comments/reading.js +14 -0
- package/dist/editor/commands/formatting/editing.js +6 -1
- package/dist/editor/commands/historyCommands.js +14 -6
- package/dist/editor/commands/index.d.ts +7 -1
- package/dist/editor/commands/index.js +4 -0
- package/dist/editor/commands/linkCommands.js +2 -0
- package/dist/editor/commands/lockCommands.js +2 -0
- package/dist/editor/commands/tabCommands.js +2 -1
- package/dist/editor/createEditor.d.ts +13 -3
- package/dist/editor/createEditor.js +21 -7
- package/dist/editor/insertImage.js +4 -1
- package/dist/editor/insertTable.js +2 -1
- package/dist/editor/paragraphEdits.d.ts +2 -0
- package/dist/editor/paragraphEdits.js +2 -0
- package/dist/editor/plugins/documentProtection.d.ts +21 -0
- package/dist/editor/plugins/documentProtection.js +44 -0
- package/dist/editor/plugins/imagePaste.js +4 -1
- package/dist/editor/plugins/keymap.d.ts +11 -1
- package/dist/editor/plugins/keymap.js +24 -4
- package/dist/editor/plugins/lockedContent.d.ts +4 -2
- package/dist/editor/plugins/lockedContent.js +1 -1
- package/dist/editor/plugins/tableContextMenu.js +2 -1
- package/dist/editor/plugins/textContextMenu.js +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/schema/docxSchema.js +5 -0
- package/dist/schema/locks.d.ts +31 -3
- package/dist/schema/locks.js +54 -3
- package/dist/schema/protection.d.ts +77 -0
- package/dist/schema/protection.js +170 -0
- package/dist/schema/protectionState.d.ts +20 -0
- package/dist/schema/protectionState.js +37 -0
- package/dist/table/cellFormatting.js +3 -1
- package/dist/table/commands.js +1 -1
- package/dist/table/merge.js +2 -2
- package/dist/ui/CommentsPanel.d.ts +3 -3
- package/dist/ui/CommentsPanel.js +26 -18
- package/dist/ui/LinkCard.d.ts +1 -2
- package/dist/ui/LinkCard.js +3 -4
- package/dist/ui/TextMenu.js +15 -10
- package/package.json +2 -2
package/dist/ui/LinkCard.d.ts
CHANGED
|
@@ -7,6 +7,5 @@ export interface LinkCardProps {
|
|
|
7
7
|
view: EditorView;
|
|
8
8
|
state: EditorState;
|
|
9
9
|
link: ActiveLinkSpan;
|
|
10
|
-
readOnly?: boolean;
|
|
11
10
|
}
|
|
12
|
-
export declare function LinkCard({ view, state, link,
|
|
11
|
+
export declare function LinkCard({ view, state, link, }: LinkCardProps): ReactElement | null;
|
package/dist/ui/LinkCard.js
CHANGED
|
@@ -49,8 +49,7 @@ function useEscape(onEscape) {
|
|
|
49
49
|
function LinkCard({
|
|
50
50
|
view,
|
|
51
51
|
state,
|
|
52
|
-
link
|
|
53
|
-
readOnly = false
|
|
52
|
+
link
|
|
54
53
|
}) {
|
|
55
54
|
const box = useRef(null);
|
|
56
55
|
const [hidden, setHidden] = useState(false);
|
|
@@ -94,7 +93,7 @@ function LinkCard({
|
|
|
94
93
|
children: /* @__PURE__ */ jsx(ExternalLink, { size: ICON_SIZE, "aria-hidden": "true" })
|
|
95
94
|
}
|
|
96
95
|
),
|
|
97
|
-
|
|
96
|
+
openLinkPanel(state) && /* @__PURE__ */ jsx(
|
|
98
97
|
"button",
|
|
99
98
|
{
|
|
100
99
|
type: "button",
|
|
@@ -106,7 +105,7 @@ function LinkCard({
|
|
|
106
105
|
children: /* @__PURE__ */ jsx(Pencil, { size: ICON_SIZE, "aria-hidden": "true" })
|
|
107
106
|
}
|
|
108
107
|
),
|
|
109
|
-
|
|
108
|
+
removeLink(state) && /* @__PURE__ */ jsx(
|
|
110
109
|
"button",
|
|
111
110
|
{
|
|
112
111
|
type: "button",
|
package/dist/ui/TextMenu.js
CHANGED
|
@@ -21,6 +21,7 @@ import { insertClipboardData } from "../editor/externalClipboard.js";
|
|
|
21
21
|
import {
|
|
22
22
|
closeTextMenu
|
|
23
23
|
} from "../editor/plugins/textContextMenu.js";
|
|
24
|
+
import { editsShut } from "../schema/protectionState.js";
|
|
24
25
|
import { editorClassNames } from "../styles/classNames.js";
|
|
25
26
|
import { usePanelAtPoint } from "./panelPlacement.js";
|
|
26
27
|
import { commandRunner } from "./runCommand.js";
|
|
@@ -103,8 +104,16 @@ function TextMenu({
|
|
|
103
104
|
const keys = useMenuKeyboard({ menu: box, onClose: close });
|
|
104
105
|
const selected = !state.selection.empty;
|
|
105
106
|
const shut = selectionTouchesLocked(state);
|
|
107
|
+
const bodyOpen = !editsShut(state);
|
|
108
|
+
const copy = {
|
|
109
|
+
label: "Copy",
|
|
110
|
+
icon: Copy,
|
|
111
|
+
hint: `${MOD}C`,
|
|
112
|
+
enabled: selected,
|
|
113
|
+
run: () => clipboardCommand(view, "copy")
|
|
114
|
+
};
|
|
106
115
|
const groups = [
|
|
107
|
-
[
|
|
116
|
+
bodyOpen ? [
|
|
108
117
|
{
|
|
109
118
|
label: "Cut",
|
|
110
119
|
icon: Scissors,
|
|
@@ -112,13 +121,7 @@ function TextMenu({
|
|
|
112
121
|
enabled: selected && !shut,
|
|
113
122
|
run: () => clipboardCommand(view, "cut")
|
|
114
123
|
},
|
|
115
|
-
|
|
116
|
-
label: "Copy",
|
|
117
|
-
icon: Copy,
|
|
118
|
-
hint: `${MOD}C`,
|
|
119
|
-
enabled: selected,
|
|
120
|
-
run: () => clipboardCommand(view, "copy")
|
|
121
|
-
},
|
|
124
|
+
copy,
|
|
122
125
|
{
|
|
123
126
|
label: "Paste",
|
|
124
127
|
icon: ClipboardPaste,
|
|
@@ -134,7 +137,7 @@ function TextMenu({
|
|
|
134
137
|
enabled: selected && !shut,
|
|
135
138
|
run: () => run(deleteSelection)
|
|
136
139
|
}
|
|
137
|
-
]
|
|
140
|
+
] : [copy]
|
|
138
141
|
];
|
|
139
142
|
groups.push([
|
|
140
143
|
{
|
|
@@ -144,7 +147,9 @@ function TextMenu({
|
|
|
144
147
|
run: () => onAddComment?.()
|
|
145
148
|
}
|
|
146
149
|
]);
|
|
147
|
-
if (allowLocking
|
|
150
|
+
if (allowLocking && bodyOpen) {
|
|
151
|
+
groups.push([lockItem(selectionLock(state), run)]);
|
|
152
|
+
}
|
|
148
153
|
const choose = (item) => {
|
|
149
154
|
if (!item.enabled) return;
|
|
150
155
|
item.run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portone/docx-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A simple DOCX editor for React, built directly on OOXML.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@playwright/test": "^1.62.1",
|
|
80
80
|
"@types/node": "^26.2.0",
|
|
81
81
|
"@types/react": "19.2.18",
|
|
82
|
-
"@types/react-dom": "19.2.
|
|
82
|
+
"@types/react-dom": "19.2.5",
|
|
83
83
|
"@vitejs/plugin-react": "^6.0.5",
|
|
84
84
|
"esbuild": "^0.28.1",
|
|
85
85
|
"jsdom": "^30.0.1",
|