@univerjs/docs-ui 0.24.0 → 0.25.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/lib/cjs/facade.js +42 -11
- package/lib/cjs/index.js +4487 -1456
- 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 +42 -11
- package/lib/es/index.js +4476 -1462
- 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 +42 -11
- package/lib/index.css +240 -26
- package/lib/index.js +4476 -1462
- 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 +6 -1
- 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 +5 -1
- package/lib/types/services/clipboard/html-to-udm/converter.d.ts +12 -0
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/type.d.ts +1 -0
- package/lib/types/services/clipboard/internal-fragment.d.ts +30 -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 +37 -10
- 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 +11 -11
package/lib/cjs/facade.js
CHANGED
|
@@ -4,7 +4,7 @@ let _univerjs_core_facade = require("@univerjs/core/facade");
|
|
|
4
4
|
let _univerjs_docs_ui = require("@univerjs/docs-ui");
|
|
5
5
|
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
6
6
|
|
|
7
|
-
//#region \0@oxc-project+runtime@0.
|
|
7
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
|
|
8
8
|
function _typeof(o) {
|
|
9
9
|
"@babel/helpers - typeof";
|
|
10
10
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -15,7 +15,7 @@ function _typeof(o) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
18
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
|
|
19
19
|
function toPrimitive(t, r) {
|
|
20
20
|
if ("object" != _typeof(t) || !t) return t;
|
|
21
21
|
var e = t[Symbol.toPrimitive];
|
|
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region \0@oxc-project+runtime@0.
|
|
31
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
|
|
32
32
|
function toPropertyKey(t) {
|
|
33
33
|
var i = toPrimitive(t, "string");
|
|
34
34
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
|
-
//#region \0@oxc-project+runtime@0.
|
|
38
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
|
|
39
39
|
function _defineProperty(e, r, t) {
|
|
40
40
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
41
41
|
value: t,
|
|
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
|
|
50
50
|
function __decorateParam(paramIndex, decorator) {
|
|
51
51
|
return function(target, key) {
|
|
52
52
|
decorator(target, key, paramIndex);
|
|
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
|
|
58
58
|
function __decorate(decorators, target, key, desc) {
|
|
59
59
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
60
60
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -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
|
/**
|