@univerjs/docs-ui 0.23.0 → 0.24.0-insiders.20260528-29f582d
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/lib/cjs/facade.js +37 -6
- package/lib/cjs/index.js +3715 -1355
- package/lib/cjs/locale/ar-SA.js +124 -0
- package/lib/cjs/locale/ca-ES.js +11 -10
- package/lib/cjs/locale/de-DE.js +124 -0
- package/lib/cjs/locale/en-US.js +11 -10
- package/lib/cjs/locale/es-ES.js +11 -10
- package/lib/cjs/locale/fa-IR.js +11 -10
- package/lib/cjs/locale/fr-FR.js +11 -10
- package/lib/cjs/locale/id-ID.js +124 -0
- package/lib/cjs/locale/it-IT.js +124 -0
- package/lib/cjs/locale/ja-JP.js +11 -10
- package/lib/cjs/locale/ko-KR.js +11 -10
- package/lib/cjs/locale/pl-PL.js +124 -0
- package/lib/cjs/locale/pt-BR.js +124 -0
- package/lib/cjs/locale/ru-RU.js +13 -12
- package/lib/cjs/locale/sk-SK.js +11 -10
- package/lib/cjs/locale/vi-VN.js +22 -21
- package/lib/cjs/locale/zh-CN.js +11 -10
- package/lib/cjs/locale/zh-HK.js +124 -0
- package/lib/cjs/locale/zh-TW.js +22 -21
- package/lib/es/facade.js +37 -6
- package/lib/es/index.js +3704 -1361
- package/lib/es/locale/ar-SA.js +123 -0
- package/lib/es/locale/ca-ES.js +11 -10
- package/lib/es/locale/de-DE.js +123 -0
- package/lib/es/locale/en-US.js +11 -10
- package/lib/es/locale/es-ES.js +11 -10
- package/lib/es/locale/fa-IR.js +11 -10
- package/lib/es/locale/fr-FR.js +11 -10
- package/lib/es/locale/id-ID.js +123 -0
- package/lib/es/locale/it-IT.js +123 -0
- package/lib/es/locale/ja-JP.js +11 -10
- package/lib/es/locale/ko-KR.js +11 -10
- package/lib/es/locale/pl-PL.js +123 -0
- package/lib/es/locale/pt-BR.js +123 -0
- package/lib/es/locale/ru-RU.js +13 -12
- package/lib/es/locale/sk-SK.js +11 -10
- package/lib/es/locale/vi-VN.js +22 -21
- package/lib/es/locale/zh-CN.js +11 -10
- package/lib/es/locale/zh-HK.js +123 -0
- package/lib/es/locale/zh-TW.js +22 -21
- package/lib/facade.js +37 -6
- package/lib/index.css +240 -26
- package/lib/index.js +3704 -1361
- package/lib/locale/ar-SA.js +123 -0
- package/lib/locale/ca-ES.js +11 -10
- package/lib/locale/de-DE.js +123 -0
- package/lib/locale/en-US.js +11 -10
- package/lib/locale/es-ES.js +11 -10
- package/lib/locale/fa-IR.js +11 -10
- package/lib/locale/fr-FR.js +11 -10
- package/lib/locale/id-ID.js +123 -0
- package/lib/locale/it-IT.js +123 -0
- package/lib/locale/ja-JP.js +11 -10
- package/lib/locale/ko-KR.js +11 -10
- package/lib/locale/pl-PL.js +123 -0
- package/lib/locale/pt-BR.js +123 -0
- package/lib/locale/ru-RU.js +13 -12
- package/lib/locale/sk-SK.js +11 -10
- package/lib/locale/vi-VN.js +22 -21
- package/lib/locale/zh-CN.js +11 -10
- package/lib/locale/zh-HK.js +123 -0
- package/lib/locale/zh-TW.js +22 -21
- package/lib/types/commands/commands/doc-block-move.command.d.ts +40 -0
- package/lib/types/commands/commands/doc-delete.command.d.ts +2 -1
- package/lib/types/commands/commands/doc-page-setup.command.d.ts +2 -0
- package/lib/types/commands/commands/list.command.d.ts +1 -0
- package/lib/types/components/paragraph-menu/index.d.ts +23 -1
- package/lib/types/controllers/render-controllers/doc-contextmenu.render-controller.d.ts +8 -2
- package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +8 -2
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +3 -3
- package/lib/types/facade/f-document.d.ts +18 -0
- package/lib/types/index.d.ts +7 -2
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +117 -110
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/menu/menu.d.ts +9 -1
- package/lib/types/menu/paragraph-menu.d.ts +21 -2
- package/lib/types/menu/schema.d.ts +1 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +2 -0
- package/lib/types/services/clipboard/copy-content-cache.d.ts +0 -1
- package/lib/types/services/clipboard/html-to-udm/converter.d.ts +10 -0
- package/lib/types/services/clipboard/internal-fragment.d.ts +28 -0
- package/lib/types/services/doc-content-insert.service.d.ts +28 -0
- package/lib/types/services/doc-event-manager.service.d.ts +19 -1
- package/lib/types/services/doc-paragraph-menu.service.d.ts +51 -3
- package/lib/types/services/doc-popup-manager.service.d.ts +2 -2
- package/lib/types/services/docs-render.service.d.ts +2 -1
- package/lib/types/services/editor/editor.d.ts +1 -0
- package/lib/types/services/selection/convert-text-range.d.ts +1 -0
- package/lib/types/services/selection/doc-selection-render.service.d.ts +4 -0
- package/lib/types/views/page-settings/index.d.ts +4 -2
- package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +2 -1
- package/lib/umd/facade.js +5 -1
- package/lib/umd/index.js +24 -9
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -10
- package/LICENSE +0 -176
- /package/lib/types/services/{doc-print-interceptor-service.d.ts → doc-print-interceptor.service.d.ts} +0 -0
package/lib/cjs/facade.js
CHANGED
|
@@ -100,22 +100,53 @@ let FDocument = class FDocument {
|
|
|
100
100
|
* @param text - The text to be added to the end of this text region.
|
|
101
101
|
*/
|
|
102
102
|
appendText(text) {
|
|
103
|
-
const unitId = this.id;
|
|
104
103
|
const { body } = this.getSnapshot();
|
|
105
104
|
if (!body) throw new Error("The document body is empty");
|
|
106
105
|
const lastPosition = body.dataStream.length - 2;
|
|
107
|
-
|
|
106
|
+
return this.insertText(text, {
|
|
108
107
|
startOffset: lastPosition,
|
|
109
108
|
endOffset: lastPosition,
|
|
110
|
-
collapsed: true,
|
|
111
109
|
segmentId: ""
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Inserts text at the provided document range. Defaults to appending before the final section break.
|
|
114
|
+
* @param text - The text to insert.
|
|
115
|
+
* @param options - Optional target range, segment id, and cursor offset.
|
|
116
|
+
*/
|
|
117
|
+
insertText(text, options = {}) {
|
|
118
|
+
var _options$startOffset, _options$endOffset, _options$segmentId;
|
|
119
|
+
const unitId = this.id;
|
|
120
|
+
const { body } = this.getSnapshot();
|
|
121
|
+
if (!body) throw new Error("The document body is empty");
|
|
122
|
+
const startOffset = (_options$startOffset = options.startOffset) !== null && _options$startOffset !== void 0 ? _options$startOffset : Math.max(0, body.dataStream.length - 2);
|
|
123
|
+
const endOffset = (_options$endOffset = options.endOffset) !== null && _options$endOffset !== void 0 ? _options$endOffset : startOffset;
|
|
124
|
+
const segmentId = (_options$segmentId = options.segmentId) !== null && _options$segmentId !== void 0 ? _options$segmentId : "";
|
|
125
|
+
const activeRange = {
|
|
126
|
+
startOffset,
|
|
127
|
+
endOffset,
|
|
128
|
+
collapsed: startOffset === endOffset,
|
|
129
|
+
segmentId
|
|
112
130
|
};
|
|
113
|
-
const { segmentId } = activeRange;
|
|
114
131
|
return this._commandService.executeCommand(_univerjs_docs_ui.InsertCommand.id, {
|
|
115
132
|
unitId,
|
|
116
133
|
body: { dataStream: text },
|
|
117
134
|
range: activeRange,
|
|
118
|
-
segmentId
|
|
135
|
+
segmentId,
|
|
136
|
+
...options.cursorOffset == null ? {} : { cursorOffset: options.cursorOffset }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Inserts one or more plain-text paragraphs at the provided document range.
|
|
141
|
+
* @param text - Paragraph text. Newlines are normalized to document paragraph separators.
|
|
142
|
+
* @param options - Optional target range, segment id, and cursor offset.
|
|
143
|
+
*/
|
|
144
|
+
insertParagraph(text = "", options = {}) {
|
|
145
|
+
var _options$cursorOffset;
|
|
146
|
+
const dataStream = `${text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n").join("\r\n")}\r\n`;
|
|
147
|
+
return this.insertText(dataStream, {
|
|
148
|
+
...options,
|
|
149
|
+
cursorOffset: (_options$cursorOffset = options.cursorOffset) !== null && _options$cursorOffset !== void 0 ? _options$cursorOffset : dataStream.length
|
|
119
150
|
});
|
|
120
151
|
}
|
|
121
152
|
/**
|
|
@@ -154,7 +185,7 @@ var FUniverDocsUIMixin = class extends _univerjs_core_facade.FUniver {
|
|
|
154
185
|
return this._injector.createInstance(FDocument, document);
|
|
155
186
|
}
|
|
156
187
|
getActiveDocument() {
|
|
157
|
-
const document = this._univerInstanceService.
|
|
188
|
+
const document = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
158
189
|
if (!document) return null;
|
|
159
190
|
return this._injector.createInstance(FDocument, document);
|
|
160
191
|
}
|