devexpress-richedit 24.1.13-build-25149-0102 → 24.1.13

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.
@@ -16391,19 +16391,22 @@ var utils_base64 = __webpack_require__(6477);
16391
16391
 
16392
16392
 
16393
16393
  class CacheImageInfo {
16394
- constructor(base64, actualId, tmpId, imageUrl, file, referenceInfo, size, isLoaded) {
16394
+ constructor(base64, actualId, tmpId, imageUrl, file, referenceInfo, size, isLoaded, isActualSize) {
16395
16395
  this._base64 = base64 !== undefined ? utils_base64.Base64Utils.normalizeToDataUrl(base64, "image/png") : undefined;
16396
16396
  this.actualId = actualId;
16397
16397
  this.tmpId = tmpId;
16398
16398
  this._referenceInfo = referenceInfo;
16399
16399
  this._size = size ? size : CacheImageInfo.emptyPictureSize;
16400
16400
  this._isLoaded = isLoaded !== undefined ? isLoaded : false;
16401
+ this._isSizeDefined = isActualSize ? isActualSize : !!size;
16401
16402
  this.imageUrl = imageUrl;
16402
16403
  this.file = file;
16403
16404
  }
16404
16405
  static get emptyPictureSize() { return new geometry_size.Size(CacheImageInfo.emptyPicDimension, CacheImageInfo.emptyPicDimension); }
16405
16406
  get isLoaded() { return this._referenceInfo ? this._referenceInfo._isLoaded : this._isLoaded; }
16406
16407
  set isLoaded(val) { this._isLoaded = val; }
16408
+ get isSizeDefined() { return this._referenceInfo ? this._referenceInfo._isSizeDefined : this._isSizeDefined; }
16409
+ set isSizeDefined(val) { this._isSizeDefined = val; }
16407
16410
  get size() { return this._referenceInfo ? this._referenceInfo._size : this._size; }
16408
16411
  set size(val) { this._size = val; }
16409
16412
  get currId() { return this.actualId !== undefined ? this.actualId : this.tmpId; }
@@ -16416,6 +16419,7 @@ class CacheImageInfo {
16416
16419
  this._base64 = undefined;
16417
16420
  this._size = undefined;
16418
16421
  this._isLoaded = undefined;
16422
+ this._isSizeDefined = undefined;
16419
16423
  this.file = undefined;
16420
16424
  }
16421
16425
  equals(obj) {
@@ -16428,7 +16432,7 @@ class CacheImageInfo {
16428
16432
  this.size.equals(obj.size);
16429
16433
  }
16430
16434
  clone() {
16431
- return new CacheImageInfo(this._base64, this.actualId, this.tmpId, this.imageUrl, this.file, this._referenceInfo, this._size, this._isLoaded);
16435
+ return new CacheImageInfo(this._base64, this.actualId, this.tmpId, this.imageUrl, this.file, this._referenceInfo, this._size, this._isLoaded, this._isSizeDefined);
16432
16436
  }
16433
16437
  shouldMakeImagePdfCompatible() {
16434
16438
  if ((0,common.isDefined)(this._convertedBase64))
@@ -22922,15 +22926,16 @@ class Field {
22922
22926
  return newInterval.start = Field.correctIntervalDueToFieldsCaseSelectionCollapsed(subDocument.fields, newInterval.start);
22923
22927
  const indexesInterval = Field.correctIntervalDueToFieldsWithoutUiChecks(subDocument, newInterval);
22924
22928
  utils_list.ListUtils.forEach(fields, (field) => {
22925
- if (field.getResultInterval().equals(newInterval) && !this.isFloatingObjectSelected(subDocument, newInterval))
22929
+ if (field.getResultInterval().equals(newInterval) && !this.isResizableObjectSelected(subDocument, newInterval))
22926
22930
  newInterval.expand(field.getAllFieldInterval());
22927
22931
  }, indexesInterval.start, indexesInterval.end);
22928
22932
  }
22929
- static isFloatingObjectSelected(subDocument, interval) {
22933
+ static isResizableObjectSelected(subDocument, interval) {
22930
22934
  if (interval.length !== 1)
22931
22935
  return false;
22932
22936
  const run = subDocument.getRunByPosition(interval.start);
22933
- return run && (run.getType() == RunType.AnchoredPictureRun || run.getType() == RunType.AnchoredTextBoxRun);
22937
+ const runType = run && run.getType();
22938
+ return runType == RunType.AnchoredPictureRun || runType == RunType.AnchoredTextBoxRun || runType == RunType.InlinePictureRun;
22934
22939
  }
22935
22940
  static correctWhenPositionInStartCode(fields, position) {
22936
22941
  if (fields.length < 1)
@@ -43016,7 +43021,7 @@ class PictureManipulator extends RunsBaseManipulator {
43016
43021
  this.history.addTransaction(() => {
43017
43022
  this.modelManipulator.range.removeInterval(new SubDocumentInterval(subDocument, interval), true, false);
43018
43023
  const newInfo = new InlinePictureInfo(pictureRun.size.clone(), new Shape(), -1, pictureRun.info.containerProperties, pictureRun.info.nonVisualDrawingProperties);
43019
- this.modelManipulator.picture.insertInlinePictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo);
43024
+ this.modelManipulator.picture.insertInlinePictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(!pictureRun.cacheInfo.isSizeDefined));
43020
43025
  });
43021
43026
  }
43022
43027
  }
@@ -43031,7 +43036,7 @@ class PictureManipulator extends RunsBaseManipulator {
43031
43036
  anchorInfo.zOrder = this.modelManipulator.floatingObject.zOrder.getNewZOrder(subDocument);
43032
43037
  this.modelManipulator.range.removeInterval(new SubDocumentInterval(subDocument, interval), true, false);
43033
43038
  const newInfo = new AnchorPictureInfo(pictureRun.size.clone(), new Shape(), anchorInfo, pictureRun.info.containerProperties, pictureRun.info.nonVisualDrawingProperties);
43034
- this.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(false));
43039
+ this.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(!pictureRun.cacheInfo.isSizeDefined));
43035
43040
  run = subDocument.getRunByPosition(interval.start);
43036
43041
  }
43037
43042
  let anchoredRun = run.getType() == RunType.AnchoredPictureRun ? run : run;
@@ -84535,7 +84540,7 @@ class ImagesApi {
84535
84540
  applyVerticalPosition(verticalPosition, anchorInfo);
84536
84541
  const anchorPictureInfo = new AnchorPictureInfo(new PictureSize(true, 0, cacheInfo, new geometry_size.Size(100, 100)), shape, anchorInfo, new NonVisualDrawingObjectInfo(), new NonVisualDrawingObjectInfo());
84537
84542
  anchorPictureInfo.containerProperties.description = options.description;
84538
- this._processor.modelManager.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, anchorPictureInfo, new ImageLoadingOptions(false, size ? new geometry_size.Size(size.width, size.height) : undefined, (_picInterval, _cacheInfo) => setTimeout(() => {
84543
+ this._processor.modelManager.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(this._subDocument, position), inputPos.charPropsBundle, anchorPictureInfo, ImageLoadingOptions.initByActualSize(size ? new geometry_size.Size(size.width, size.height) : undefined, (_picInterval, _cacheInfo) => setTimeout(() => {
84539
84544
  callback(getFloatingImageApiFromRun(this._processor, this._subDocument, this._subDocument.getRunAndIndexesByPosition(position)));
84540
84545
  }, 0)));
84541
84546
  this._processor.endUpdate();
@@ -95774,7 +95779,7 @@ class WordHolderInfo {
95774
95779
  }
95775
95780
  if (res == null)
95776
95781
  return false;
95777
- if (this.rowFormatter.row.isEmpty()) {
95782
+ if (this.rowFormatter.row.isEmpty() || this.rowFormatter.row.containsSpacesOnly()) {
95778
95783
  if (this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow) {
95779
95784
  this.rowFormatter.rowSizesManager.rowFormattingInfo.findNextYPosWhatHasNeededSpace(res.requiredWidth);
95780
95785
  return this.pushBoxes();
@@ -127931,8 +127936,18 @@ class PrintDocumentOnClient extends CommandBase {
127931
127936
  return true;
127932
127937
  }
127933
127938
  printCore(htmlPrinting, printWindow, closePrintDialogWithHtmlPreview, needSwitchViewType, needToggleHiddenSymbols) {
127934
- if (htmlPrinting)
127935
- this.generatePrintDocument(printWindow, closePrintDialogWithHtmlPreview);
127939
+ if (htmlPrinting) {
127940
+ this.generatePrintDocument(printWindow.document);
127941
+ printWindow.focus();
127942
+ const interval = setInterval(() => {
127943
+ if (printWindow.document.readyState == 'complete') {
127944
+ printWindow.print();
127945
+ if (closePrintDialogWithHtmlPreview && !browser.Browser.AndroidMobilePlatform)
127946
+ printWindow.close();
127947
+ clearInterval(interval);
127948
+ }
127949
+ }, 100);
127950
+ }
127936
127951
  else {
127937
127952
  pdfExport(this.control, (blob, _stream) => {
127938
127953
  if (window.navigator.msSaveOrOpenBlob && !browser.Browser.Edge)
@@ -127947,12 +127962,27 @@ class PrintDocumentOnClient extends CommandBase {
127947
127962
  this.control.commandManager.getCommand(RichEditClientCommand.ToggleShowWhitespace).execute(this.control.commandManager.isPublicApiCall);
127948
127963
  this.control.commandManager.isPrintingProcessing = false;
127949
127964
  }
127950
- generatePrintDocument(printWindow, closePrintDialogWithHtmlPreview) {
127965
+ generatePrintDocument(document) {
127951
127966
  const height = this.control.layout.pages[0].height;
127952
127967
  const width = this.control.layout.pages[0].width;
127953
- let printWindowContent = `<!DOCTYPE html>
127954
- <html moznomarginboxes mozdisallowselectionprint>
127968
+ let fontLink = "";
127969
+ let divsToLoadFonts = "";
127970
+ const googleFonts = this.getGoogleFonts();
127971
+ if (googleFonts.length > 0) {
127972
+ fontLink = this.createGoogleFontStyleLink(googleFonts);
127973
+ divsToLoadFonts = googleFonts.reduce((prev, curr) => {
127974
+ const fontStyles = [`font-family:${curr}`, 'font-weight:bold', 'font-style:italic'];
127975
+ const result = [];
127976
+ for (let i = 1; i <= fontStyles.length; i++)
127977
+ result.push(`<div style="font-size:1pt;position:absolute;top:-1000px;${fontStyles.slice(0, i).join(';')}">${curr}</div>`);
127978
+ return prev ? [prev, ...result].join('\n') : result.join('\n');
127979
+ }, null);
127980
+ }
127981
+ document.documentElement.innerHTML =
127982
+ `<!DOCTYPE html>
127983
+ <html moznomarginboxes mozdisallowselectionprint>
127955
127984
  <head>
127985
+ ${fontLink}
127956
127986
  <style ${this._nonce ? `nonce="${this._nonce}"` : ''}>
127957
127987
  html, body {
127958
127988
  margin: 0;
@@ -127971,22 +128001,25 @@ class PrintDocumentOnClient extends CommandBase {
127971
128001
  </style>
127972
128002
  </head>
127973
128003
  <body>
128004
+ ${divsToLoadFonts}
127974
128005
  </body>
127975
- </html>`;
127976
- printWindow.document.write(printWindowContent);
127977
- printWindow.document.close();
128006
+ </html>`;
127978
128007
  this.generatePrintContent().forEach((child) => {
127979
- printWindow.document.body.appendChild(child);
128008
+ document.body.appendChild(child);
127980
128009
  });
127981
- printWindow.focus();
127982
- const interval = setInterval(() => {
127983
- if (printWindow.document.readyState == 'complete') {
127984
- printWindow.print();
127985
- if (closePrintDialogWithHtmlPreview && !browser.Browser.AndroidMobilePlatform)
127986
- printWindow.close();
127987
- clearInterval(interval);
127988
- }
127989
- }, 100);
128010
+ }
128011
+ getGoogleFonts() {
128012
+ return this.control.modelManager.richOptions.fonts.fonts.reduce((res, f) => {
128013
+ if (f.useGoogleFonts)
128014
+ res.push(f.fontFamily);
128015
+ return res;
128016
+ }, []);
128017
+ }
128018
+ createGoogleFontStyleLink(fontFamilies) {
128019
+ const url = new URL('https://fonts.googleapis.com/css');
128020
+ url.searchParams.append('family', fontFamilies.join('|'));
128021
+ url.searchParams.append('display', 'auto');
128022
+ return `<link href="${url.toString()}" rel="stylesheet" />`;
127990
128023
  }
127991
128024
  generatePrintContent() {
127992
128025
  const layout = this.control.layout;
@@ -141755,7 +141788,7 @@ class ClientRichEdit {
141755
141788
  this.contextMenuSettings = settings.contextMenuSettings;
141756
141789
  this.fullScreenHelper = new FullScreenHelper(element);
141757
141790
  if (true)
141758
- external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVREZzBkbWxZYUZOS1MyWnRRams0U0VOTVkxTTRNaUlLZlE9PS53SkN1UVJhY3dIaU9DMEdWZFBPVlNacDJsRThrcTdTbUZTTWpIMXgvamxEMnowbzQvYWFkVm9zK1g2ZzlwSDZaYjdUUXdOdlZvQkduRUNwblB2M0ZaOUV4eWlkK3pybUxITE8yZnIyVzFTOEJOWE1YaE1mSlNPdjJ3aCs5SDBSd2lMejJxUT09In0=')));
141791
+ external_DevExpress_config_default()(JSON.parse(atob('eyJsaWNlbnNlS2V5IjoiZXdvZ0lDSm1iM0p0WVhRaU9pQXhMQW9nSUNKcGJuUmxjbTVoYkZWellXZGxTV1FpT2lBaVUyTnFlV05wY0hrM1ptcHpZMm8wV2xwdWVFUTVUaUlLZlE9PS5NQTY1NWlJNi9wMlJTZ2NnamlnVXFOTDVNUU15YjAzRGh3ZjdUeWlvcURSajIwL3Izbnl3S3dJOHdUVlM4aUR3eG1ZeWN4UmlIYWtiTTN3dS8ydUs2UTY2V3VXalFEeFlJbXhhajVBVFUrZDQzN2gwTGQvYXlqTHRiZWlhbFJBRkxWVWh6Zz09In0=')));
141759
141792
  this.prepareElement(element, settings);
141760
141793
  this.initDefaultFontsAndStyles();
141761
141794
  this.initBars(settings.ribbon, settings.fonts);