@coco-vexel/coco-office-editor 1.0.0 → 1.0.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.
- package/README.md +33 -1
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/dist/index.cjs +352 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +353 -101
- package/dist/index.js.map +1 -1
- package/dist/{model-DB6aN6uJ.d.cts → model-DNNBhhCB.d.cts} +4 -3
- package/dist/{model-DB6aN6uJ.d.ts → model-DNNBhhCB.d.ts} +4 -3
- package/dist/{native-B6B649CC.d.ts → native-OrEUvS8p.d.ts} +5 -1
- package/dist/native-TMv552dv.d.cts +317 -0
- package/dist/native-TMv552dv.d.ts +317 -0
- package/dist/{native-Ct9nN06K.d.cts → native-f2y3N8N5.d.cts} +5 -1
- package/dist/ppt-native.cjs +129 -59
- package/dist/ppt-native.cjs.map +1 -1
- package/dist/ppt-native.d.cts +1 -1
- package/dist/ppt-native.d.ts +1 -1
- package/dist/ppt-native.js +130 -60
- package/dist/ppt-native.js.map +1 -1
- package/dist/ppt.cjs +129 -58
- package/dist/ppt.cjs.map +1 -1
- package/dist/ppt.d.cts +3 -306
- package/dist/ppt.d.ts +3 -306
- package/dist/ppt.js +130 -60
- package/dist/ppt.js.map +1 -1
- package/dist/read-only-1_LQCO1d.d.cts +7 -0
- package/dist/read-only-1_LQCO1d.d.ts +7 -0
- package/dist/spreadsheet.cjs +114 -17
- package/dist/spreadsheet.cjs.map +1 -1
- package/dist/spreadsheet.d.cts +15 -3
- package/dist/spreadsheet.d.ts +15 -3
- package/dist/spreadsheet.js +114 -18
- package/dist/spreadsheet.js.map +1 -1
- package/dist/word-editing.d.cts +1 -1
- package/dist/word-editing.d.ts +1 -1
- package/dist/word-native.cjs +132 -23
- package/dist/word-native.cjs.map +1 -1
- package/dist/word-native.d.cts +2 -2
- package/dist/word-native.d.ts +2 -2
- package/dist/word-native.js +132 -23
- package/dist/word-native.js.map +1 -1
- package/dist/word-prosemirror.d.cts +1 -1
- package/dist/word-prosemirror.d.ts +1 -1
- package/dist/word.cjs +145 -23
- package/dist/word.cjs.map +1 -1
- package/dist/word.d.cts +5 -4
- package/dist/word.d.ts +5 -4
- package/dist/word.js +145 -24
- package/dist/word.js.map +1 -1
- package/package.json +10 -10
- package/src/styles/editor.css +1 -0
package/README.md
CHANGED
|
@@ -38,7 +38,10 @@ Create `index.html`:
|
|
|
38
38
|
Create `main.js`, then run `npx vite` and open the printed HTTP URL:
|
|
39
39
|
|
|
40
40
|
```js
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
buildPptEditorViewFromPptx,
|
|
43
|
+
renderNativePptEditor,
|
|
44
|
+
} from '@coco-vexel/coco-office-editor/ppt';
|
|
42
45
|
|
|
43
46
|
const input = document.querySelector('#file');
|
|
44
47
|
const save = document.querySelector('#save');
|
|
@@ -102,6 +105,33 @@ This is an unstyled integration shell; the native PPT renderer supplies its edit
|
|
|
102
105
|
|
|
103
106
|
All import paths above start with `@coco-vexel/coco-office-editor`. If your app directly imports Core (for example to apply Word changes), declare it explicitly with `npm install @coco-vexel/coco-office`. Examples below named `host`, `xlsxBytes` or `persistWorkbook` are integration fragments: supply your own mount, file bytes and persistence callback.
|
|
104
107
|
|
|
108
|
+
### Read-only preview
|
|
109
|
+
|
|
110
|
+
All three native editors accept `readOnly: true` at mount time and expose
|
|
111
|
+
`isReadOnly()` / `setReadOnly(readOnly)`. Read-only mode is enforced by the
|
|
112
|
+
Word runtime, spreadsheet runtime, and PPT session as well as their DOM event
|
|
113
|
+
handlers. Programmatic spreadsheet and PPT mutations reject with
|
|
114
|
+
`EditorReadOnlyError` (`code: 'EDITOR_READ_ONLY'`); Word's synchronous command
|
|
115
|
+
contract reports the same condition through `canDispatch() === false` and
|
|
116
|
+
`dispatch() === false`.
|
|
117
|
+
|
|
118
|
+
Read-only preview intentionally keeps scrolling, zoom owned by the host,
|
|
119
|
+
selection/copy, links, worksheet switching, and slide navigation available.
|
|
120
|
+
It blocks typing, IME, cut/paste/drop, formatting, structure changes,
|
|
121
|
+
drag/resize, undo/redo, and mutation APIs. Navigation and selection do not emit
|
|
122
|
+
change events or advance revisions. Spreadsheet sort/filter/freeze operations
|
|
123
|
+
remain blocked because they currently modify the workbook rather than a
|
|
124
|
+
separate view state.
|
|
125
|
+
|
|
126
|
+
PPT hosts that render their own navigator can also pass `showSlideList: false`:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const preview = renderNativePptEditor(host, view, {
|
|
130
|
+
readOnly: true,
|
|
131
|
+
showSlideList: false,
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
105
135
|
Word custom Shadow DOM integration needs stylesheet text via `styleText`; Vite supports `@coco-vexel/coco-office-editor/styles.css?inline`. Other bundlers must provide an equivalent CSS-string loader. The `?inline` suffix is a Vite feature, not a portable JavaScript import. Spreadsheet's default isolated renderer and the default PPT renderer manage their surfaces. Use a mount with an explicit nonzero height.
|
|
106
136
|
|
|
107
137
|
The complete three-format file/open/edit/export flow, including Word export diagnostics, is in the [public demo source](https://github.com/coco-vexel/coco-office/blob/main/packages/editor/demo/main.js). No private product dependency is needed. These editors are experimental; file round-trip success does not certify visual parity or support for every advanced object.
|
|
@@ -159,6 +189,7 @@ import '@coco-vexel/coco-office-editor/styles.css';
|
|
|
159
189
|
|
|
160
190
|
const documentView = await buildWordEditorViewFromDocx(docxBytes);
|
|
161
191
|
const editor = renderNativeWordEditor(host, documentView, {
|
|
192
|
+
readOnly: false,
|
|
162
193
|
contextMenu: true,
|
|
163
194
|
// Pass the bundled editor CSS text when the host uses Shadow DOM isolation.
|
|
164
195
|
// Vite hosts can load it with: import editorStyles from '../styles/editor.css?inline';
|
|
@@ -297,6 +328,7 @@ import { renderSpreadsheetEditor } from '@coco-vexel/coco-office-editor/spreadsh
|
|
|
297
328
|
|
|
298
329
|
const editor = await renderSpreadsheetEditor(host, xlsxBytes, {
|
|
299
330
|
workbookId: 'browser-document.xlsx',
|
|
331
|
+
readOnly: false,
|
|
300
332
|
showSheetTabs: true,
|
|
301
333
|
// Shadow DOM isolation is enabled by default; use 'none' only for legacy hosts.
|
|
302
334
|
styleIsolation: 'shadow',
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -81,7 +81,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
81
81
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
82
82
|
THE SOFTWARE.
|
|
83
83
|
|
|
84
|
-
## prosemirror-model@1.25.
|
|
84
|
+
## prosemirror-model@1.25.12
|
|
85
85
|
|
|
86
86
|
Declared license: MIT
|
|
87
87
|
|
|
@@ -133,7 +133,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
133
133
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
134
134
|
THE SOFTWARE.
|
|
135
135
|
|
|
136
|
-
## prosemirror-transform@1.12.
|
|
136
|
+
## prosemirror-transform@1.12.2
|
|
137
137
|
|
|
138
138
|
Declared license: MIT
|
|
139
139
|
|
|
@@ -159,7 +159,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
159
159
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
160
160
|
THE SOFTWARE.
|
|
161
161
|
|
|
162
|
-
## prosemirror-view@1.42.
|
|
162
|
+
## prosemirror-view@1.42.6
|
|
163
163
|
|
|
164
164
|
Declared license: MIT
|
|
165
165
|
|