@univerjs/core 1.0.0-beta.1 → 1.0.0-beta.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/lib/cjs/facade.js +3 -3
- package/lib/cjs/index.js +85 -6
- package/lib/es/facade.js +3 -3
- package/lib/es/index.js +81 -8
- package/lib/facade.js +3 -3
- package/lib/index.js +81 -8
- package/lib/types/common/lodash.d.ts +1 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +48 -4
- package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +2 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +2 -0
- package/lib/types/facade/f-univer.d.ts +3 -3
- package/lib/types/sheets/typedef.d.ts +2 -0
- package/lib/umd/index.js +24 -24
- package/package.json +4 -4
|
@@ -1558,6 +1558,24 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1558
1558
|
* ```
|
|
1559
1559
|
*/
|
|
1560
1560
|
code(text: string): RichTextBuilder;
|
|
1561
|
+
/**
|
|
1562
|
+
* Appends linked text.
|
|
1563
|
+
*
|
|
1564
|
+
* This is the agent-friendly alias of `insertLink(text, url)`. Use `setLink(start, end, url)` only when applying a
|
|
1565
|
+
* link to text that is already present and numeric offsets are unavoidable.
|
|
1566
|
+
*
|
|
1567
|
+
* @param text Visible link text to append. An empty string is ignored.
|
|
1568
|
+
* @param url Link destination.
|
|
1569
|
+
* @returns The current builder for chaining.
|
|
1570
|
+
* @example
|
|
1571
|
+
* ```ts
|
|
1572
|
+
* const richText = univerAPI.newRichText()
|
|
1573
|
+
* .text('Read ')
|
|
1574
|
+
* .link('Univer documentation', 'https://docs.univer.ai')
|
|
1575
|
+
* .text(' for details.');
|
|
1576
|
+
* ```
|
|
1577
|
+
*/
|
|
1578
|
+
link(text: string, url: string): RichTextBuilder;
|
|
1561
1579
|
/**
|
|
1562
1580
|
* Appends one ordered, unordered, or checklist paragraph.
|
|
1563
1581
|
*
|
|
@@ -1745,6 +1763,28 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1745
1763
|
* ```
|
|
1746
1764
|
*/
|
|
1747
1765
|
cancelLink(start: number, end: number): RichTextBuilder;
|
|
1766
|
+
/**
|
|
1767
|
+
* Removes a link while preserving its visible text.
|
|
1768
|
+
*
|
|
1769
|
+
* Link ids are available from `getLinks()`. This readable alias avoids exposing text offsets for the common case.
|
|
1770
|
+
* Use `cancelLink(start, end)` only when removing every link in a known text range.
|
|
1771
|
+
*
|
|
1772
|
+
* @param id Link range id returned by `getLinks()`.
|
|
1773
|
+
* @returns The current builder for chaining.
|
|
1774
|
+
* @example
|
|
1775
|
+
* ```ts
|
|
1776
|
+
* const richText = univerAPI.newRichText().link('Univer', 'https://univer.ai');
|
|
1777
|
+
* const [link] = richText.getLinks();
|
|
1778
|
+
* if (link) richText.removeLink(link.rangeId);
|
|
1779
|
+
* ```
|
|
1780
|
+
*/
|
|
1781
|
+
removeLink(id: string): RichTextBuilder;
|
|
1782
|
+
/**
|
|
1783
|
+
* Updates a link destination while preserving its visible text.
|
|
1784
|
+
* @param id Link range id returned by `getLinks()`.
|
|
1785
|
+
* @param url New link destination.
|
|
1786
|
+
* @returns The current builder for chaining.
|
|
1787
|
+
*/
|
|
1748
1788
|
updateLink(id: string, url: string): RichTextBuilder;
|
|
1749
1789
|
/**
|
|
1750
1790
|
* Inserts a new paragraph to the end
|
|
@@ -1770,10 +1810,14 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1770
1810
|
*/
|
|
1771
1811
|
insertParagraph(start: number, paragraphStyle: ParagraphStyleBuilder): RichTextBuilder;
|
|
1772
1812
|
/**
|
|
1773
|
-
* Inserts
|
|
1774
|
-
*
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1813
|
+
* Inserts linked text at the end of the builder or at an explicit text offset.
|
|
1814
|
+
*
|
|
1815
|
+
* Application and agent code should prefer `link(text, url)` for left-to-right construction. The positional
|
|
1816
|
+
* overload remains available for advanced document-model integrations.
|
|
1817
|
+
*
|
|
1818
|
+
* @param text Visible link text to insert.
|
|
1819
|
+
* @param url Link destination.
|
|
1820
|
+
* @returns The current builder for chaining.
|
|
1777
1821
|
*/
|
|
1778
1822
|
insertLink(text: string, url: string): RichTextBuilder;
|
|
1779
1823
|
insertLink(start: number, text: string, url: string): RichTextBuilder;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';
|
|
17
|
-
import type { IDocumentBody, IDrawingParam } from '../../../../types/interfaces';
|
|
17
|
+
import type { IDocumentBody, IDocumentData, IDrawingParam } from '../../../../types/interfaces';
|
|
18
18
|
import type { DocumentDataModel } from '../../document-data-model';
|
|
19
19
|
import type { JSONXActions } from '../../json-x/json-x';
|
|
20
20
|
export interface IAddDrawingParam {
|
|
@@ -23,4 +23,5 @@ export interface IAddDrawingParam {
|
|
|
23
23
|
drawings: IDrawingParam[];
|
|
24
24
|
}
|
|
25
25
|
export declare function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[];
|
|
26
|
+
export declare function removeDrawingReferences(documentData: Pick<IDocumentData, 'body' | 'drawings' | 'drawingsOrder'>, selections: ITextRange[], body?: IDocumentBody | undefined): JSONXActions[];
|
|
26
27
|
export declare const addDrawing: (param: IAddDrawingParam) => false | JSONXActions;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { addCustomDecorationTextX, deleteCustomDecorationTextX } from './custom-decoration';
|
|
17
17
|
import { copyCustomRange, getCustomRangesInterestsWithSelection, isIntersecting } from './custom-range';
|
|
18
|
+
import { removeDrawingReferences } from './drawings';
|
|
18
19
|
import { getParagraphsInRange, getParagraphsInRanges, isSegmentIntersects, makeSelection, normalizeSelection, transformParagraphs } from './selection';
|
|
19
20
|
import { addCustomRangeTextX, deleteCustomRangeTextX, deleteSelectionTextX, retainSelectionTextX } from './text-x-utils';
|
|
20
21
|
export declare class BuildTextUtils {
|
|
@@ -65,6 +66,7 @@ export declare class BuildTextUtils {
|
|
|
65
66
|
};
|
|
66
67
|
static drawing: {
|
|
67
68
|
add: (param: import("./drawings").IAddDrawingParam) => false | import("ot-json1").JSONOp;
|
|
69
|
+
remove: typeof removeDrawingReferences;
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
export { getSingleDataStreamChange } from './data-stream-change';
|
|
@@ -279,9 +279,9 @@ export declare class FUniver extends Disposable {
|
|
|
279
279
|
* @example
|
|
280
280
|
* ```ts
|
|
281
281
|
* const richText = univerAPI.newRichText()
|
|
282
|
-
* .
|
|
283
|
-
* .
|
|
284
|
-
* .
|
|
282
|
+
* .text('Read ')
|
|
283
|
+
* .link('Univer documentation', 'https://docs.univer.ai')
|
|
284
|
+
* .text(' for details.');
|
|
285
285
|
* ```
|
|
286
286
|
*/
|
|
287
287
|
newRichText(): RichTextBuilder;
|
|
@@ -266,6 +266,8 @@ export interface IFontRenderExtension {
|
|
|
266
266
|
export interface ICellDataForSheetInterceptor extends ICellData {
|
|
267
267
|
interceptorStyle?: Nullable<IStyleData>;
|
|
268
268
|
isInArrayFormulaRange?: Nullable<boolean>;
|
|
269
|
+
/** Marks intercepted cell data prepared for percentage editing. */
|
|
270
|
+
isPercentFormat?: boolean;
|
|
269
271
|
markers?: ICellMarks;
|
|
270
272
|
customRender?: Nullable<ICellCustomRender[]>;
|
|
271
273
|
interceptorAutoHeight?: () => number | undefined;
|