devexpress-richedit 24.1.2-beta → 24.1.3
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/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.d.ts +1 -1
- package/dist/dx.richedit.js +259 -200
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/client-rich-edit.js +2 -2
- package/lib/client/public/ribbon/creator.js +1 -0
- package/lib/client/public/ribbon/items/select-box.d.ts +2 -0
- package/lib/client/public/ribbon/items/select-box.js +7 -0
- package/lib/client/public/utils.d.ts +4 -0
- package/lib/client/public/utils.js +15 -0
- package/lib/client/ribbon/i-toolbar-item-options.d.ts +1 -0
- package/lib/common/canvas/canvas-manager.js +1 -1
- package/lib/common/formats/html/export/html-builder.js +8 -4
- package/lib/common/formats/html/export/html-export.d.ts +12 -0
- package/lib/common/formats/html/export/html-export.js +113 -99
- package/lib/common/formats/html/import/html-importer.js +21 -8
- package/lib/common/ui/ruler/controls/divisions.js +2 -1
- package/lib/common/ui/ruler/controls/indent/first-line.js +4 -3
- package/lib/common/ui/ruler/controls/indent/left.js +5 -4
- package/lib/common/ui/ruler/ruler.js +2 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -53,8 +53,8 @@ export class ClientRichEdit {
|
|
53
53
|
this.rawDataSource = settings.rawDataSource;
|
54
54
|
this.contextMenuSettings = settings.contextMenuSettings;
|
55
55
|
this.fullScreenHelper = new FullScreenHelper(element);
|
56
|
-
if ("")
|
57
|
-
config(JSON.parse(atob("")));
|
56
|
+
if ("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFUbHhVemQxYzBSQ01HVlpTbDlrVGkxb2FYaGtVU0lLZlE9PS5INTlJcG94ZC90cWdVcE1leVdhamhubjl2NnFtMkFrQmc2MW0yU05ZUHIreFBrdnRLUm04Wm4rU08rUVQ3NEt3MVpWQ0pGeEJYV1dJRlNyRG1EZlVqYmV6N2RzTnpJbTR6S1A5M2l4amVQR0Jnb2o4eG9VSmZvNldmZzNMblpTUlNLcHFpZz09In0=")
|
57
|
+
config(JSON.parse(atob("eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaWFUbHhVemQxYzBSQ01HVlpTbDlrVGkxb2FYaGtVU0lLZlE9PS5INTlJcG94ZC90cWdVcE1leVdhamhubjl2NnFtMkFrQmc2MW0yU05ZUHIreFBrdnRLUm04Wm4rU08rUVQ3NEt3MVpWQ0pGeEJYV1dJRlNyRG1EZlVqYmV6N2RzTnpJbTR6S1A5M2l4amVQR0Jnb2o4eG9VSmZvNldmZzNMblpTUlNLcHFpZz09In0=")));
|
58
58
|
this.prepareElement(element, settings);
|
59
59
|
this.initDefaultFontsAndStyles();
|
60
60
|
this.initBars(settings.ribbon, settings.fonts);
|
@@ -73,6 +73,7 @@ function createItems(rawItems) {
|
|
73
73
|
displayExpr: rawItem.displayExpr,
|
74
74
|
valueExpr: rawItem.valueExpr,
|
75
75
|
value: rawItem.value,
|
76
|
+
valueType: rawItem.valueType,
|
76
77
|
showClearButton: rawItem.showClearButton,
|
77
78
|
placeholder: rawItem.placeholder,
|
78
79
|
acceptCustomValue: rawItem.acceptCustomValue,
|
@@ -6,6 +6,7 @@ export interface RibbonSelectBoxItemOptions {
|
|
6
6
|
displayExpr?: string;
|
7
7
|
valueExpr?: string;
|
8
8
|
value?: any;
|
9
|
+
valueType?: string;
|
9
10
|
textOptions?: RibbonItemTextOptions;
|
10
11
|
showClearButton?: boolean;
|
11
12
|
placeholder?: string;
|
@@ -20,6 +21,7 @@ export declare class RibbonSelectBoxItem extends RibbonItemBase {
|
|
20
21
|
valueExpr?: string;
|
21
22
|
width?: any;
|
22
23
|
value?: any;
|
24
|
+
valueType?: string;
|
23
25
|
textOptions: RibbonItemTextOptions;
|
24
26
|
showClearButton: boolean;
|
25
27
|
placeholder?: string;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { TypeConverterFactory } from '../../utils';
|
1
2
|
import { RibbonItemBase, RibbonItemType } from './base';
|
2
3
|
import { convertToFunction } from '../../../../common/utils/utils';
|
3
4
|
import { isDefined } from '@devexpress/utils/lib/utils/common';
|
@@ -11,11 +12,17 @@ export class RibbonSelectBoxItem extends RibbonItemBase {
|
|
11
12
|
this.displayExpr = options.displayExpr;
|
12
13
|
this.valueExpr = options.valueExpr;
|
13
14
|
this.value = options.value;
|
15
|
+
this.valueType = options.valueType;
|
14
16
|
this._localizeDataSourceItems = options._localizeDataSourceItems === undefined ? false : options._localizeDataSourceItems;
|
15
17
|
this.textOptions = (_a = options.textOptions) !== null && _a !== void 0 ? _a : {};
|
16
18
|
this.showClearButton = options.showClearButton === undefined ? false : options.showClearButton;
|
17
19
|
this.placeholder = options.placeholder;
|
18
20
|
this.acceptCustomValue = isDefined(options.acceptCustomValue) ? options.acceptCustomValue : false;
|
19
21
|
this.onCustomItemCreating = options.onCustomItemCreating ? convertToFunction(options.onCustomItemCreating) : undefined;
|
22
|
+
if (!this.onCustomItemCreating && this.valueType) {
|
23
|
+
const converter = TypeConverterFactory.create(this.valueType);
|
24
|
+
if (converter)
|
25
|
+
this.onCustomItemCreating = (e) => e.customItem = { text: e.text, value: converter(e.text) };
|
26
|
+
}
|
20
27
|
}
|
21
28
|
}
|
@@ -30,4 +30,8 @@ export declare class Utils {
|
|
30
30
|
static convertBlobToArrayBuffer(content: File | Blob, callback: (buffer: ArrayBuffer) => void): void;
|
31
31
|
static getIntervalComplement(bound: IntervalApi, intervals: IntervalApi[]): IntervalApi[];
|
32
32
|
}
|
33
|
+
export declare class TypeConverterFactory {
|
34
|
+
static create(valueType: string): (text: string) => unknown | null;
|
35
|
+
private static createCore;
|
36
|
+
}
|
33
37
|
export {};
|
@@ -70,3 +70,18 @@ export class Utils {
|
|
70
70
|
return ListUtils.map(coreResult, curr => convertToIntervalApi(curr));
|
71
71
|
}
|
72
72
|
}
|
73
|
+
export class TypeConverterFactory {
|
74
|
+
static create(valueType) {
|
75
|
+
const converter = this.createCore(valueType);
|
76
|
+
return converter ? text => { var _a; return (_a = converter(text)) !== null && _a !== void 0 ? _a : text; } : null;
|
77
|
+
}
|
78
|
+
static createCore(valueType) {
|
79
|
+
const strType = valueType.toLowerCase();
|
80
|
+
switch (strType) {
|
81
|
+
case 'number':
|
82
|
+
return text => parseFloat(text);
|
83
|
+
default:
|
84
|
+
return null;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
@@ -73,7 +73,7 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
73
73
|
DomUtils.removeClassName(this.viewManager.canvas, CSSCLASS_FOCUSED);
|
74
74
|
}
|
75
75
|
getCanvasWidth() {
|
76
|
-
return SizeUtils.
|
76
|
+
return SizeUtils.getClientWidth(this.viewManager.canvas);
|
77
77
|
}
|
78
78
|
onCanvasMouseWheel(evt) {
|
79
79
|
if (!this.viewManager.layout)
|
@@ -76,11 +76,15 @@ export class HtmlBuilder {
|
|
76
76
|
return this;
|
77
77
|
}
|
78
78
|
endChild(tagName) {
|
79
|
-
|
80
|
-
|
81
|
-
currentElement
|
79
|
+
try {
|
80
|
+
let currentElement = this._currentElement;
|
81
|
+
while (currentElement.tagName.toLowerCase() !== tagName.toLowerCase())
|
82
|
+
currentElement = currentElement.parentElement;
|
83
|
+
this._currentElement = currentElement.parentElement;
|
84
|
+
}
|
85
|
+
catch (e) {
|
86
|
+
console.warn(`The element with the ${tagName} tag is not found.`);
|
82
87
|
}
|
83
|
-
this._currentElement = currentElement.parentElement;
|
84
88
|
return this;
|
85
89
|
}
|
86
90
|
addDefaultMarkup(content) {
|
@@ -1,9 +1,16 @@
|
|
1
1
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
2
2
|
import { DocumentModel } from '../../../model/document-model';
|
3
3
|
import { RangeCopy } from '../../../model/manipulators/range/create-range-copy-operation';
|
4
|
+
import { Paragraph } from '../../../model/paragraph/paragraph';
|
4
5
|
import { SubDocument } from '../../../model/sub-document';
|
5
6
|
import { HtmlBuilder } from './html-builder';
|
6
7
|
import { IExportModelOptions } from '../../i-document-exporter';
|
8
|
+
interface List {
|
9
|
+
numberingListIndex: number;
|
10
|
+
listLevelIndex: number;
|
11
|
+
start: number;
|
12
|
+
end: number;
|
13
|
+
}
|
7
14
|
export declare class HtmlExporter {
|
8
15
|
rangeCopy: RangeCopy;
|
9
16
|
private exportModelOptions;
|
@@ -15,7 +22,11 @@ export declare class HtmlExporter {
|
|
15
22
|
private get pageIndex();
|
16
23
|
constructor(exportModelOptions: IExportModelOptions);
|
17
24
|
getHtmlElementsByInterval(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, guidLabel: string): HtmlBuilder;
|
25
|
+
getParagraphsByInterval(subDocument: SubDocument, interval: FixedInterval): Paragraph[];
|
26
|
+
getListsByParagraphs(paragraphs: Paragraph[]): List[];
|
18
27
|
private addParentTableRecursively;
|
28
|
+
startList(model: DocumentModel, subDocument: SubDocument, interval: FixedInterval, builder: HtmlBuilder, lists: List[], position: number): void;
|
29
|
+
private endList;
|
19
30
|
private getHtmlText;
|
20
31
|
private getBorderCssString;
|
21
32
|
private getTableWidthUnitCssString;
|
@@ -23,3 +34,4 @@ export declare class HtmlExporter {
|
|
23
34
|
private getCellStyle;
|
24
35
|
private getTextBoxStyleString;
|
25
36
|
}
|
37
|
+
export {};
|
@@ -45,47 +45,8 @@ export class HtmlExporter {
|
|
45
45
|
let remainLength = interval.length;
|
46
46
|
let currentPosition = interval.start;
|
47
47
|
let resultBuilder = new HtmlBuilder();
|
48
|
-
const
|
49
|
-
const
|
50
|
-
for (let i = 0, paragraphInInterval; paragraphInInterval = paragraphsInInterval[i]; i++) {
|
51
|
-
if (interval.containsWithIntervalEnd(paragraphInInterval.getEndPosition()))
|
52
|
-
paragraphs.push(paragraphInInterval);
|
53
|
-
}
|
54
|
-
const listsInInterval = [];
|
55
|
-
for (let i = 0, paragraph; paragraph = paragraphs[i]; i++) {
|
56
|
-
if (paragraph.isInList()) {
|
57
|
-
const paragraphNumberingListIndex = paragraph.getNumberingListIndex();
|
58
|
-
const paragraphListLevelIndex = paragraph.getListLevelIndex();
|
59
|
-
const paragraphStart = paragraph.startLogPosition.value;
|
60
|
-
const paragraphEnd = paragraph.getEndPosition();
|
61
|
-
let existingItem = null;
|
62
|
-
for (let j = 0; j < listsInInterval.length; j++) {
|
63
|
-
if (listsInInterval[j].numberingListIndex == paragraphNumberingListIndex && listsInInterval[j].listLevelIndex == paragraphListLevelIndex)
|
64
|
-
existingItem = listsInInterval[j];
|
65
|
-
}
|
66
|
-
if (existingItem && (paragraphListLevelIndex == 0 || existingItem.end == paragraphStart
|
67
|
-
|| listsInInterval[listsInInterval.length - 1].listLevelIndex > paragraphListLevelIndex)) {
|
68
|
-
existingItem.end = paragraphEnd;
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
listsInInterval.push({
|
72
|
-
numberingListIndex: paragraphNumberingListIndex, listLevelIndex: paragraphListLevelIndex,
|
73
|
-
start: paragraphStart, end: paragraphEnd
|
74
|
-
});
|
75
|
-
}
|
76
|
-
let listLevelIndex = paragraphListLevelIndex;
|
77
|
-
while (listLevelIndex > 0) {
|
78
|
-
let parentItem = null;
|
79
|
-
for (let j = 0; j < listsInInterval.length; j++) {
|
80
|
-
if (listsInInterval[j].listLevelIndex == listLevelIndex - 1)
|
81
|
-
parentItem = listsInInterval[j];
|
82
|
-
}
|
83
|
-
if (parentItem)
|
84
|
-
parentItem.end = paragraphEnd;
|
85
|
-
listLevelIndex--;
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
48
|
+
const paragraphs = this.getParagraphsByInterval(subDocument, interval);
|
49
|
+
const lists = this.getListsByParagraphs(paragraphs);
|
89
50
|
let isInsideFieldCode = false;
|
90
51
|
let fieldDeep = 0;
|
91
52
|
let isInsideHyperlink = false;
|
@@ -95,53 +56,6 @@ export class HtmlExporter {
|
|
95
56
|
while (iterator.moveNext()) {
|
96
57
|
const tableCell = Table.getTableCellByPosition(subDocument.tables, iterator.currentInterval().start);
|
97
58
|
const isContinueMergingCell = tableCell && tableCell.verticalMerging === TableCellMergingState.Continue;
|
98
|
-
let listToStartIndex = -1;
|
99
|
-
const listsToEndIndices = [];
|
100
|
-
if (!tableCell) {
|
101
|
-
if (listsInInterval.length) {
|
102
|
-
const currentPosition = iterator.currentInterval().start;
|
103
|
-
for (let i = 0; i < listsInInterval.length; i++) {
|
104
|
-
if (listsInInterval[i].start == currentPosition)
|
105
|
-
listToStartIndex = i;
|
106
|
-
if (listsInInterval[i].end == iterator.currentInterval().end)
|
107
|
-
listsToEndIndices.push(i);
|
108
|
-
}
|
109
|
-
if (listToStartIndex < 0 && currentPosition == interval.start) {
|
110
|
-
const firstParagraph = subDocument.getParagraphByPosition(currentPosition);
|
111
|
-
if (firstParagraph.getNumberingListIndex() == listsInInterval[0].numberingListIndex)
|
112
|
-
listToStartIndex = 0;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
if (listToStartIndex > -1) {
|
116
|
-
const numberingList = model.numberingLists[listsInInterval[listToStartIndex].numberingListIndex];
|
117
|
-
let listFormatType = "";
|
118
|
-
switch (numberingList.levels[listsInInterval[listToStartIndex].listLevelIndex].getListLevelProperties().format) {
|
119
|
-
case NumberingFormat.Bullet:
|
120
|
-
listFormatType = "disc";
|
121
|
-
break;
|
122
|
-
case NumberingFormat.Decimal:
|
123
|
-
listFormatType = "decimal";
|
124
|
-
break;
|
125
|
-
case NumberingFormat.LowerLetter:
|
126
|
-
listFormatType = "lower-alpha";
|
127
|
-
break;
|
128
|
-
case NumberingFormat.UpperLetter:
|
129
|
-
listFormatType = "upper-alpha";
|
130
|
-
break;
|
131
|
-
case NumberingFormat.LowerRoman:
|
132
|
-
listFormatType = "lower-roman";
|
133
|
-
break;
|
134
|
-
case NumberingFormat.UpperRoman:
|
135
|
-
listFormatType = "upper-roman";
|
136
|
-
break;
|
137
|
-
default:
|
138
|
-
break;
|
139
|
-
}
|
140
|
-
resultBuilder
|
141
|
-
.startChild(numberingList.getListType() != NumberingType.Bullet ? "ol" : "ul")
|
142
|
-
.configure((e) => e.style.cssText = "list-style-type:" + listFormatType);
|
143
|
-
}
|
144
|
-
}
|
145
59
|
const run = iterator.currentRun;
|
146
60
|
const isRunInEmptyParagraph = run.paragraph.length === 1;
|
147
61
|
if (paragraphs.length && (run.getType() != RunType.ParagraphRun || isRunInEmptyParagraph)) {
|
@@ -212,6 +126,7 @@ export class HtmlExporter {
|
|
212
126
|
});
|
213
127
|
}
|
214
128
|
}
|
129
|
+
this.startList(model, subDocument, interval, resultBuilder, lists, iterator.currentInterval().start);
|
215
130
|
if (!isContinueMergingCell) {
|
216
131
|
const maskedParagraphProperties = currentParagraph.getParagraphMergedProperties();
|
217
132
|
let paragraphStyle = "";
|
@@ -292,17 +207,15 @@ export class HtmlExporter {
|
|
292
207
|
paragraphStyle += HtmlConverter.getCssRules(charProps, charProps.textColor.toRgb(this.colorProvider), false, false, false)
|
293
208
|
.join(";");
|
294
209
|
}
|
295
|
-
if (currentParagraph.isInList()
|
210
|
+
if (currentParagraph.isInList())
|
296
211
|
resultBuilder.startChild('li');
|
297
212
|
resultBuilder
|
298
213
|
.startChild('p')
|
299
214
|
.configure((e) => {
|
300
|
-
if (paragraphStyle)
|
215
|
+
if (paragraphStyle)
|
301
216
|
e.style.cssText = paragraphStyle;
|
302
|
-
|
303
|
-
if (isRunInEmptyParagraph) {
|
217
|
+
if (isRunInEmptyParagraph)
|
304
218
|
e.innerHTML = " ";
|
305
|
-
}
|
306
219
|
});
|
307
220
|
}
|
308
221
|
}
|
@@ -314,6 +227,10 @@ export class HtmlExporter {
|
|
314
227
|
case RunType.ParagraphRun:
|
315
228
|
if (!isContinueMergingCell) {
|
316
229
|
html.addCallback((builder) => builder.endChild('p'));
|
230
|
+
if (run.paragraph.isInList()) {
|
231
|
+
html.addCallback((builder) => builder.endChild('li'));
|
232
|
+
html.addCallback((builder) => this.endList(model, builder, lists, iterator.currentInterval().end));
|
233
|
+
}
|
317
234
|
let paragraphEndPosition = run.paragraph.getEndPosition();
|
318
235
|
if (tableCell) {
|
319
236
|
let parentRow = tableCell.parentRow;
|
@@ -491,10 +408,6 @@ export class HtmlExporter {
|
|
491
408
|
}
|
492
409
|
}
|
493
410
|
resultBuilder.assignFrom(html);
|
494
|
-
if (listsToEndIndices.length) {
|
495
|
-
for (let i = listsToEndIndices.length - 1; i >= 0; i--)
|
496
|
-
resultBuilder.endChild(model.numberingLists[listsInInterval[listsToEndIndices[i]].numberingListIndex].getListType() != NumberingType.Bullet ? "ol" : "ul");
|
497
|
-
}
|
498
411
|
currentPosition += length;
|
499
412
|
remainLength -= length;
|
500
413
|
}
|
@@ -531,6 +444,57 @@ export class HtmlExporter {
|
|
531
444
|
.endChild('span');
|
532
445
|
return resultBuilder;
|
533
446
|
}
|
447
|
+
getParagraphsByInterval(subDocument, interval) {
|
448
|
+
const paragraphsInInterval = subDocument.getParagraphsByInterval(interval);
|
449
|
+
const paragraphs = [];
|
450
|
+
for (let i = 0, paragraphInInterval; paragraphInInterval = paragraphsInInterval[i]; i++) {
|
451
|
+
if (interval.containsWithIntervalEnd(paragraphInInterval.getEndPosition()))
|
452
|
+
paragraphs.push(paragraphInInterval);
|
453
|
+
}
|
454
|
+
return paragraphs;
|
455
|
+
}
|
456
|
+
getListsByParagraphs(paragraphs) {
|
457
|
+
const listsInInterval = [];
|
458
|
+
for (let i = 0, paragraph; paragraph = paragraphs[i]; i++) {
|
459
|
+
if (paragraph.isInList()) {
|
460
|
+
const paragraphNumberingListIndex = paragraph.getNumberingListIndex();
|
461
|
+
const paragraphListLevelIndex = paragraph.getListLevelIndex();
|
462
|
+
const paragraphStart = paragraph.startLogPosition.value;
|
463
|
+
const paragraphEnd = paragraph.getEndPosition();
|
464
|
+
let existingItem = null;
|
465
|
+
for (let j = 0; j < listsInInterval.length; j++) {
|
466
|
+
if (listsInInterval[j].numberingListIndex === paragraphNumberingListIndex
|
467
|
+
&& listsInInterval[j].listLevelIndex === paragraphListLevelIndex) {
|
468
|
+
existingItem = listsInInterval[j];
|
469
|
+
}
|
470
|
+
}
|
471
|
+
if (existingItem && (paragraphListLevelIndex === 0 || existingItem.end == paragraphStart
|
472
|
+
|| listsInInterval[listsInInterval.length - 1].listLevelIndex > paragraphListLevelIndex)) {
|
473
|
+
existingItem.end = paragraphEnd;
|
474
|
+
}
|
475
|
+
else {
|
476
|
+
listsInInterval.push({
|
477
|
+
numberingListIndex: paragraphNumberingListIndex,
|
478
|
+
listLevelIndex: paragraphListLevelIndex,
|
479
|
+
start: paragraphStart,
|
480
|
+
end: paragraphEnd,
|
481
|
+
});
|
482
|
+
}
|
483
|
+
let listLevelIndex = paragraphListLevelIndex;
|
484
|
+
while (listLevelIndex > 0) {
|
485
|
+
let parentItem = null;
|
486
|
+
for (let j = 0; j < listsInInterval.length; j++) {
|
487
|
+
if (listsInInterval[j].listLevelIndex == listLevelIndex - 1)
|
488
|
+
parentItem = listsInInterval[j];
|
489
|
+
}
|
490
|
+
if (parentItem)
|
491
|
+
parentItem.end = paragraphEnd;
|
492
|
+
listLevelIndex--;
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
return listsInInterval;
|
497
|
+
}
|
534
498
|
addParentTableRecursively(model, builder, parentCell, paragraphStartPosition) {
|
535
499
|
const parentRow = parentCell.parentRow;
|
536
500
|
const parentTable = parentRow.parentTable;
|
@@ -548,9 +512,9 @@ export class HtmlExporter {
|
|
548
512
|
builder
|
549
513
|
.startChild('td')
|
550
514
|
.configure(el => {
|
551
|
-
el.style.cssText =
|
515
|
+
el.style.cssText = 'mso-cell-special:placeholder';
|
552
516
|
el.setAttribute('colspan', parentRow.gridBefore.toString());
|
553
|
-
el.innerHTML =
|
517
|
+
el.innerHTML = ' ';
|
554
518
|
})
|
555
519
|
.endChild('td');
|
556
520
|
}
|
@@ -565,6 +529,56 @@ export class HtmlExporter {
|
|
565
529
|
});
|
566
530
|
}
|
567
531
|
}
|
532
|
+
startList(model, subDocument, interval, builder, lists, position) {
|
533
|
+
if (!lists.length)
|
534
|
+
return;
|
535
|
+
let listIndex = lists.findIndex((list) => list.start === position);
|
536
|
+
if (listIndex < 0 && position === interval.start) {
|
537
|
+
const firstParagraph = subDocument.getParagraphByPosition(position);
|
538
|
+
if (firstParagraph.getNumberingListIndex() === lists[0].numberingListIndex)
|
539
|
+
listIndex = 0;
|
540
|
+
}
|
541
|
+
if (listIndex > -1) {
|
542
|
+
const numberingList = model.numberingLists[lists[listIndex].numberingListIndex];
|
543
|
+
const numberingListFormat = numberingList.levels[lists[listIndex].listLevelIndex].getListLevelProperties().format;
|
544
|
+
const numberingListType = numberingList.getListType();
|
545
|
+
let listFormatType = "";
|
546
|
+
switch (numberingListFormat) {
|
547
|
+
case NumberingFormat.Bullet:
|
548
|
+
listFormatType = "disc";
|
549
|
+
break;
|
550
|
+
case NumberingFormat.Decimal:
|
551
|
+
listFormatType = "decimal";
|
552
|
+
break;
|
553
|
+
case NumberingFormat.LowerLetter:
|
554
|
+
listFormatType = "lower-alpha";
|
555
|
+
break;
|
556
|
+
case NumberingFormat.UpperLetter:
|
557
|
+
listFormatType = "upper-alpha";
|
558
|
+
break;
|
559
|
+
case NumberingFormat.LowerRoman:
|
560
|
+
listFormatType = "lower-roman";
|
561
|
+
break;
|
562
|
+
case NumberingFormat.UpperRoman:
|
563
|
+
listFormatType = "upper-roman";
|
564
|
+
break;
|
565
|
+
default:
|
566
|
+
break;
|
567
|
+
}
|
568
|
+
builder
|
569
|
+
.startChild(numberingListType !== NumberingType.Bullet ? "ol" : "ul")
|
570
|
+
.configure((e) => e.style.cssText = "list-style-type:" + listFormatType);
|
571
|
+
}
|
572
|
+
}
|
573
|
+
endList(model, builder, lists, endPosition) {
|
574
|
+
for (let i = lists.length - 1; i >= 0; i--) {
|
575
|
+
if (lists[i].end === endPosition) {
|
576
|
+
const listType = model.numberingLists[lists[i].numberingListIndex].getListType();
|
577
|
+
lists.splice(i, 1);
|
578
|
+
builder.endChild(listType != NumberingType.Bullet ? "ol" : "ul");
|
579
|
+
}
|
580
|
+
}
|
581
|
+
}
|
568
582
|
getHtmlText(text) {
|
569
583
|
const result = new HtmlBuilder();
|
570
584
|
for (let i = 0; i < text.length; i++) {
|
@@ -177,7 +177,7 @@ export class HtmlImporter {
|
|
177
177
|
const missTag = HtmlImporter.MapMissTablePropertiesByTagNames[ListUtils.last(this.levelInfo).tagImporter.elementTag()];
|
178
178
|
ListUtils.forEach(this.currElementChilds, (childElement) => {
|
179
179
|
const childElemStyle = this.getStyles(childElement);
|
180
|
-
if (!childElemStyle)
|
180
|
+
if (!Object.keys(childElemStyle).length)
|
181
181
|
return;
|
182
182
|
for (var prop in this.getStyles(element)) {
|
183
183
|
if (missTag && /^(border|background|marginLeft)/gi.test(prop))
|
@@ -189,13 +189,24 @@ export class HtmlImporter {
|
|
189
189
|
});
|
190
190
|
}
|
191
191
|
getStyles(element) {
|
192
|
-
var _a
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
192
|
+
var _a;
|
193
|
+
const styleStr = (_a = element.getAttribute) === null || _a === void 0 ? void 0 : _a.call(element, 'style');
|
194
|
+
if (!styleStr)
|
195
|
+
return {};
|
196
|
+
const urlRegExp = new RegExp('url\\(.*?\\)', 'gi');
|
197
|
+
const urlKey = '$URL';
|
198
|
+
const urlValues = styleStr.match(urlRegExp);
|
199
|
+
return styleStr
|
200
|
+
.replace(urlRegExp, urlKey)
|
201
|
+
.split(';')
|
202
|
+
.reduceRight((res, style) => {
|
203
|
+
if (!style)
|
204
|
+
return res;
|
205
|
+
const colonIndex = style.indexOf(':');
|
206
|
+
const key = style.substring(0, colonIndex).trim();
|
207
|
+
const value = style.substring(colonIndex + 1).trim();
|
208
|
+
res[key] = value === urlKey ? urlValues.pop() : value;
|
209
|
+
return res;
|
199
210
|
}, {});
|
200
211
|
}
|
201
212
|
addRun(run, forceAdd = false) {
|
@@ -265,6 +276,8 @@ export class HtmlImporter {
|
|
265
276
|
html = html.replace(/<font[^>]*>([^<>]+)<\/font>/gi, '$1');
|
266
277
|
html = html.replace(/<span\s*><span\s*>([^<>]+)<\/span><\/span>/ig, '$1');
|
267
278
|
html = html.replace(/<span>([^<>]+)<\/span>/gi, '$1');
|
279
|
+
html = html.replace(/\s*(<li[\S\s]*?>)\s*/gi, '$1');
|
280
|
+
html = html.replace(/\s*(<\/li>)\s*/gi, '$1');
|
268
281
|
html = html.replace(/<li([^>]*)>([^<>]+)<\/li>/gi, '<li$1><p>$2</p></li>');
|
269
282
|
html = html.replace(/<li([^>]*)>(([^<>]*)<(?!p)[\s\S]*?)<\/li>/gi, '<li$1><p>$2</p></li>');
|
270
283
|
html = html.replace(/<caption([^>]*)>[\s\S]*?<\/caption>/gi, '');
|
@@ -4,6 +4,7 @@ import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
|
|
4
4
|
import { DocumentRenderer } from '../../../canvas/renderes/common/document-renderer';
|
5
5
|
import { RULER_CLASS_NAME, RULLER_NUMBER_CORRECTION } from '../settings';
|
6
6
|
import { RulerBase } from './base';
|
7
|
+
import { SizeUtils } from '../../../../common/utils/size-utils';
|
7
8
|
export const MINOR_TOP_AND_BOTTOM_MARGIN = 4;
|
8
9
|
export const MAJOR_TOP_AND_BOTTOM_MARGIN = 2;
|
9
10
|
export const DIVISION_CONTAINER_CLASS_NAME = RULER_CLASS_NAME + "Divisions";
|
@@ -20,7 +21,7 @@ export class RulerDivisionsControl extends RulerBase {
|
|
20
21
|
this.controls.ruler.rootElement.appendChild(this.rootElement);
|
21
22
|
if (Browser.IE && Browser.MajorVersion <= 9)
|
22
23
|
this.rootElement.offsetParent;
|
23
|
-
this.height = this.rootElement
|
24
|
+
this.height = SizeUtils.getOffsetHeight(this.rootElement);
|
24
25
|
createDivisionElements(this.rootElement, unitCount, divisionInfo, this.height);
|
25
26
|
this.initialLeft = -(unitCount * divisionInfo.unitSize - RULLER_NUMBER_CORRECTION);
|
26
27
|
}
|
@@ -5,6 +5,7 @@ import { RULLER_NUMBER_CORRECTION } from '../../settings';
|
|
5
5
|
import { RulerModelState } from '../base';
|
6
6
|
import { RulerTemplateManager } from '../template-manager';
|
7
7
|
import { RulerBaseIndentControl, RulerMinDistanceBetweenIndents } from './base';
|
8
|
+
import { SizeUtils } from '../../../../../common/utils/size-utils';
|
8
9
|
export class RulerFirstLineIndentDragHandle extends RulerBaseIndentControl {
|
9
10
|
constructor(modelData, controls) {
|
10
11
|
super(modelData, controls);
|
@@ -14,8 +15,8 @@ export class RulerFirstLineIndentDragHandle extends RulerBaseIndentControl {
|
|
14
15
|
this.rootElement.title = this.modelData.settings.titles.firstLineIndent;
|
15
16
|
this.controls.ruler.rootElement.appendChild(this.rootElement);
|
16
17
|
this.adjustByTop();
|
17
|
-
this.leftCorrection = Math.round(this.rootElement
|
18
|
-
this._heightOfProtrudingPart = this.rootElement
|
18
|
+
this.leftCorrection = Math.round(SizeUtils.getOffsetWidth(this.rootElement) / 2);
|
19
|
+
this._heightOfProtrudingPart = SizeUtils.getOffsetHeight(this.rootElement) - this.controls.divisions.height / 2;
|
19
20
|
}
|
20
21
|
get heightOfProtrudingPart() { return this.modelData.settings.showLeftIndent ? this._heightOfProtrudingPart : 0; }
|
21
22
|
getRootClassName() {
|
@@ -23,7 +24,7 @@ export class RulerFirstLineIndentDragHandle extends RulerBaseIndentControl {
|
|
23
24
|
this.modelData.settings.styles.firstLineIndent.className;
|
24
25
|
}
|
25
26
|
adjustByTop() {
|
26
|
-
const mainElementHeight = this.rootElement
|
27
|
+
const mainElementHeight = SizeUtils.getOffsetHeight(this.rootElement);
|
27
28
|
const divisionsControlHeight = this.controls.divisions.height;
|
28
29
|
this.rootElement.style.marginTop = (mainElementHeight - divisionsControlHeight) / 2 + "px";
|
29
30
|
}
|
@@ -6,6 +6,7 @@ import { RICH_EDIT_CLASS_NAME_PREFIX, RULLER_NUMBER_CORRECTION } from '../../set
|
|
6
6
|
import { RulerModelState } from '../base';
|
7
7
|
import { RulerTemplateManager } from '../template-manager';
|
8
8
|
import { RulerBaseIndentControl, RulerMinDistanceBetweenIndents } from './base';
|
9
|
+
import { SizeUtils } from '../../../../../common/utils/size-utils';
|
9
10
|
const LEFT_INDENT_DRAG_HANDLE_BODY = RICH_EDIT_CLASS_NAME_PREFIX + "leftIndentDragHandleBody";
|
10
11
|
export class RulerLeftIndentDragHandle extends RulerBaseIndentControl {
|
11
12
|
constructor(modelData, controls) {
|
@@ -26,18 +27,18 @@ export class RulerLeftIndentDragHandle extends RulerBaseIndentControl {
|
|
26
27
|
const mainElementWidth = this.topElement.offsetWidth;
|
27
28
|
this.bodyElement.style.width = mainElementWidth + "px";
|
28
29
|
const style = this.rootElement.style;
|
29
|
-
style.height = this.topElement
|
30
|
+
style.height = SizeUtils.getOffsetHeight(this.topElement) + SizeUtils.getOffsetHeight(this.bodyElement) + "px";
|
30
31
|
style.width = mainElementWidth + "px";
|
31
32
|
style.marginTop = this.controls.divisions.height / 2 + "px";
|
32
33
|
this.bodyElement.title = this.modelData.settings.titles.leftIndent;
|
33
34
|
this.topElement.title = this.modelData.settings.titles.hangingIndent;
|
34
|
-
this.leftCorrection = Math.round(this.rootElement
|
35
|
-
this._heightOfProtrudingPart = this.rootElement
|
35
|
+
this.leftCorrection = Math.round(SizeUtils.getOffsetWidth(this.rootElement) / 2);
|
36
|
+
this._heightOfProtrudingPart = SizeUtils.getOffsetHeight(this.rootElement) - this.controls.divisions.height / 2;
|
36
37
|
}
|
37
38
|
get heightOfProtrudingPart() { return this.modelData.settings.showLeftIndent ? this._heightOfProtrudingPart : 0; }
|
38
39
|
getRootClassName() { return this.modelData.settings.styles.leftIndent.className; }
|
39
40
|
adjustByTop() {
|
40
|
-
const mainElementHeight = this.rootElement
|
41
|
+
const mainElementHeight = SizeUtils.getOffsetHeight(this.rootElement);
|
41
42
|
const divisionsControlHeight = this.controls.divisions.height;
|
42
43
|
this.rootElement.style.marginTop = (mainElementHeight - divisionsControlHeight) / 2 + "px";
|
43
44
|
}
|
@@ -4,6 +4,7 @@ import { Flag } from '@devexpress/utils/lib/class/flag';
|
|
4
4
|
import { RulerControls } from './manager';
|
5
5
|
import { RulerModelData } from './model-data';
|
6
6
|
import { RulerVisibility } from './settings';
|
7
|
+
import { SizeUtils } from '../../../common/utils/size-utils';
|
7
8
|
var HorizontalRulerEventType;
|
8
9
|
(function (HorizontalRulerEventType) {
|
9
10
|
HorizontalRulerEventType[HorizontalRulerEventType["None"] = 0] = "None";
|
@@ -190,7 +191,7 @@ export class HorizontalRulerControl extends BatchUpdatableObject {
|
|
190
191
|
return this._visible;
|
191
192
|
}
|
192
193
|
getHeight() {
|
193
|
-
return this.initialized ? this.controls.wrapper.rootElement
|
194
|
+
return this.initialized ? SizeUtils.getOffsetHeight(this.controls.wrapper.rootElement) : 0;
|
194
195
|
}
|
195
196
|
onViewTypeChanged() {
|
196
197
|
this.innerSetVisible(this._visible && !this.modelData.innerClientProperties.viewsSettings.isSimpleView);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "devexpress-richedit",
|
3
|
-
"version": "24.1.
|
3
|
+
"version": "24.1.3",
|
4
4
|
"homepage": "https://www.devexpress.com/",
|
5
5
|
"bugs": "https://www.devexpress.com/support/",
|
6
6
|
"author": "Developer Express Inc.",
|
@@ -14,13 +14,13 @@
|
|
14
14
|
"build-nspell": "webpack --mode production --config=bin/nspell.webpack.config.js"
|
15
15
|
},
|
16
16
|
"peerDependencies": {
|
17
|
-
"devextreme": "24.1.
|
18
|
-
"devextreme-dist": "24.1.
|
17
|
+
"devextreme": "24.1.3",
|
18
|
+
"devextreme-dist": "24.1.3"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
21
|
"jszip": "~3.10.1",
|
22
22
|
"tslib": "2.6.0",
|
23
|
-
"@devexpress/utils": "1.4.
|
23
|
+
"@devexpress/utils": "^1.4.3"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"webpack": "5.75.0",
|