@talrace/ngx-noder 19.0.43 → 19.0.45

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.
@@ -1388,6 +1388,9 @@ class ExternalComponent extends BaseNoderComponent {
1388
1388
  }
1389
1389
  focus() {
1390
1390
  super.focus();
1391
+ if (this.isText) {
1392
+ this.rerender();
1393
+ }
1391
1394
  if (this.skipSidenav()) {
1392
1395
  return;
1393
1396
  }
@@ -1395,6 +1398,9 @@ class ExternalComponent extends BaseNoderComponent {
1395
1398
  }
1396
1399
  blur() {
1397
1400
  super.blur();
1401
+ if (this.isText) {
1402
+ this.rerender();
1403
+ }
1398
1404
  if (this.skipSidenav()) {
1399
1405
  return;
1400
1406
  }
@@ -1919,7 +1925,7 @@ const PARENT_TAG = 'APP-NOD-EDITOR';
1919
1925
  const TABLE_CELL_TAG = 'APP-NOD-TABLE-CELL';
1920
1926
  const EDGE_TAG = 'APP-NOD-EDGE';
1921
1927
  const IMAGE_TAG = 'APP-NOD-IMAGE';
1922
- const CUSTOM_TAG = 'APP-NOD-CUSTOM-ELEMENT';
1928
+ const CUSTOM_TAG = 'app-nod-custom-element';
1923
1929
 
1924
1930
  class CustomElementSearchResult {
1925
1931
  constructor(init) {
@@ -2060,13 +2066,10 @@ class FormatHelper {
2060
2066
  }
2061
2067
  }
2062
2068
 
2063
- const POPUP_HEIGHT = 150;
2064
-
2065
2069
  class GrammarPopupComponent {
2066
2070
  constructor(editorService, overlayService) {
2067
2071
  this.editorService = editorService;
2068
2072
  this.overlayService = overlayService;
2069
- this.hostHeight = `${POPUP_HEIGHT}px`;
2070
2073
  }
2071
2074
  onSuggestionClick(index) {
2072
2075
  this.editorService.applyGrammarSuggestion(this.error, index, this.paragraphIndex);
@@ -2077,15 +2080,12 @@ class GrammarPopupComponent {
2077
2080
  this.overlayService.close();
2078
2081
  }
2079
2082
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GrammarPopupComponent, deps: [{ token: EditorService }, { token: OverlayService }], target: i0.ɵɵFactoryTarget.Component }); }
2080
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: GrammarPopupComponent, isStandalone: true, selector: "app-nod-grammar-popup", inputs: { error: "error", paragraphIndex: "paragraphIndex" }, host: { properties: { "style.height": "this.hostHeight" } }, ngImport: i0, template: "<span\n class=\"ignore\"\n (click)=\"onIgnoreClick()\">\n {{ 'NODER.LABEL.IGNORE' | translate }}\n</span>\n<span class=\"message\">{{ error.message }}</span>\n<div class=\"options\">\n @for (suggestion of error.replacements; track i; let i = $index) {\n <span\n class=\"suggestion\"\n (click)=\"onSuggestionClick(i)\">\n {{ suggestion }}\n </span>\n }\n</div>\n", styles: [":host{border-radius:8px;display:flex;flex-direction:column;padding:8px;max-width:500px;gap:5px;box-shadow:0 8px 20px #00000026,0 4px 10px #0000001a}.message{flex:1;display:flex;align-items:center;justify-content:center;text-align:center;font-style:italic;font-size:14px;padding:0 10px;border-bottom-width:1px;border-bottom-style:solid}.options{display:flex;justify-content:center;flex-wrap:wrap;gap:5px;padding:5px 0}.suggestion{font-weight:600;cursor:pointer;text-decoration:underline;padding:3px 8px}.ignore{border-radius:4px;margin-left:auto;font-weight:600;cursor:pointer;transition:all .3s ease;padding:3px 8px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2083
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: GrammarPopupComponent, isStandalone: true, selector: "app-nod-grammar-popup", inputs: { error: "error", paragraphIndex: "paragraphIndex" }, ngImport: i0, template: "<span class=\"message\">{{ error.message }}</span>\n<div class=\"options\">\n @for (suggestion of error.replacements; track i; let i = $index) {\n <span\n class=\"suggestion\"\n (click)=\"onSuggestionClick(i)\">\n {{ suggestion }}\n </span>\n }\n</div>\n<button\n mat-button\n class=\"ignore\"\n (click)=\"onIgnoreClick()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-ignore\"></mat-icon>\n <span>\n {{ 'NODER.LABEL.IGNORE' | translate }}\n </span>\n</button>\n", styles: [":host{border-radius:8px;display:flex;flex-direction:column;padding:8px;max-width:500px;gap:5px}.message{flex:1;display:flex;align-items:center;justify-content:center;text-align:center;font-size:12px}.options{display:flex;flex-flow:column wrap;justify-content:center;gap:5px;padding:10px 0;border-bottom-width:1px;border-bottom-style:solid}.suggestion{font-weight:600;font-size:14px;cursor:pointer;text-decoration:underline;padding:3px 8px}.ignore{margin-left:auto;font-size:12px;letter-spacing:0;cursor:pointer;height:32px}.ignore mat-icon{margin-right:4px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2081
2084
  }
2082
2085
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GrammarPopupComponent, decorators: [{
2083
2086
  type: Component,
2084
- args: [{ selector: 'app-nod-grammar-popup', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, TranslateModule], standalone: true, template: "<span\n class=\"ignore\"\n (click)=\"onIgnoreClick()\">\n {{ 'NODER.LABEL.IGNORE' | translate }}\n</span>\n<span class=\"message\">{{ error.message }}</span>\n<div class=\"options\">\n @for (suggestion of error.replacements; track i; let i = $index) {\n <span\n class=\"suggestion\"\n (click)=\"onSuggestionClick(i)\">\n {{ suggestion }}\n </span>\n }\n</div>\n", styles: [":host{border-radius:8px;display:flex;flex-direction:column;padding:8px;max-width:500px;gap:5px;box-shadow:0 8px 20px #00000026,0 4px 10px #0000001a}.message{flex:1;display:flex;align-items:center;justify-content:center;text-align:center;font-style:italic;font-size:14px;padding:0 10px;border-bottom-width:1px;border-bottom-style:solid}.options{display:flex;justify-content:center;flex-wrap:wrap;gap:5px;padding:5px 0}.suggestion{font-weight:600;cursor:pointer;text-decoration:underline;padding:3px 8px}.ignore{border-radius:4px;margin-left:auto;font-weight:600;cursor:pointer;transition:all .3s ease;padding:3px 8px}\n"] }]
2085
- }], ctorParameters: () => [{ type: EditorService }, { type: OverlayService }], propDecorators: { hostHeight: [{
2086
- type: HostBinding,
2087
- args: ['style.height']
2088
- }], error: [{
2087
+ args: [{ selector: 'app-nod-grammar-popup', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, MatIconModule, TranslateModule], standalone: true, template: "<span class=\"message\">{{ error.message }}</span>\n<div class=\"options\">\n @for (suggestion of error.replacements; track i; let i = $index) {\n <span\n class=\"suggestion\"\n (click)=\"onSuggestionClick(i)\">\n {{ suggestion }}\n </span>\n }\n</div>\n<button\n mat-button\n class=\"ignore\"\n (click)=\"onIgnoreClick()\">\n <mat-icon\n fontSet=\"noder-icon\"\n fontIcon=\"icon-ignore\"></mat-icon>\n <span>\n {{ 'NODER.LABEL.IGNORE' | translate }}\n </span>\n</button>\n", styles: [":host{border-radius:8px;display:flex;flex-direction:column;padding:8px;max-width:500px;gap:5px}.message{flex:1;display:flex;align-items:center;justify-content:center;text-align:center;font-size:12px}.options{display:flex;flex-flow:column wrap;justify-content:center;gap:5px;padding:10px 0;border-bottom-width:1px;border-bottom-style:solid}.suggestion{font-weight:600;font-size:14px;cursor:pointer;text-decoration:underline;padding:3px 8px}.ignore{margin-left:auto;font-size:12px;letter-spacing:0;cursor:pointer;height:32px}.ignore mat-icon{margin-right:4px}\n"] }]
2088
+ }], ctorParameters: () => [{ type: EditorService }, { type: OverlayService }], propDecorators: { error: [{
2089
2089
  type: Input
2090
2090
  }], paragraphIndex: [{
2091
2091
  type: Input
@@ -5204,7 +5204,7 @@ class TableOperationsHelper {
5204
5204
  return null;
5205
5205
  }
5206
5206
  return new ApplyTableCellsStylesModel({
5207
- cellsData: this.getCellDataFromBorderCells(cellsMap, (oldBorder) => new BordersStyleModel({ ...oldBorder, ...new BordersStyleModel({ lineStyle: style }) })),
5207
+ cellsData: this.getCellDataFromBorderCells(cellsMap, (oldBorder) => new BordersStyleModel({ ...oldBorder, lineStyle: style })),
5208
5208
  insertIndex: table.insertIndex
5209
5209
  });
5210
5210
  }
@@ -5219,7 +5219,7 @@ class TableOperationsHelper {
5219
5219
  return null;
5220
5220
  }
5221
5221
  return new ApplyTableCellsStylesModel({
5222
- cellsData: this.getCellDataFromBorderCells(cellsMap, (oldBorder) => new BordersStyleModel({ ...oldBorder, ...new BordersStyleModel({ width }) })),
5222
+ cellsData: this.getCellDataFromBorderCells(cellsMap, (oldBorder) => new BordersStyleModel({ ...oldBorder, width })),
5223
5223
  insertIndex: table.insertIndex
5224
5224
  });
5225
5225
  }
@@ -6584,6 +6584,8 @@ class RenderingHelper {
6584
6584
  static renderExternalText(fragment, textStyle, wordSpacing, instance, line, renderedTokensInLine, paragraphStartIndex) {
6585
6585
  let additionalTokens = 0;
6586
6586
  let renderedIndexes = 0;
6587
+ const style = `max-height:${instance.ascent() + instance.descent()}px;`;
6588
+ const classes = instance.isFocused ? [CUSTOM_TAG, 'noder-focussed', 'noder-pointing'] : [CUSTOM_TAG, 'noder-pointing'];
6587
6589
  const attributes = [
6588
6590
  { name: 'data-session-id', value: `${instance.sessionId}` },
6589
6591
  { name: 'data-insert-index', value: `${instance.insertIndex}` }
@@ -6593,7 +6595,7 @@ class RenderingHelper {
6593
6595
  const customText = line.customTexts.find(x => x.index === instance.insertIndex - paragraphStartIndex);
6594
6596
  const customTextFragment = text.substring(customText.start, customText.end);
6595
6597
  if (!line.wordSpacing) {
6596
- this.renderText(fragment, textStyle, customTextFragment, wordSpacing, [CUSTOM_TAG, 'noder-pointing'], attributes);
6598
+ this.renderText(fragment, textStyle, customTextFragment, wordSpacing, classes, attributes, style);
6597
6599
  additionalTokens += customTextFragment.length;
6598
6600
  }
6599
6601
  else {
@@ -6601,15 +6603,15 @@ class RenderingHelper {
6601
6603
  const wordSpacingEnd = line.wordSpacingEndToken - renderedTokensInLine - renderedIndexes - additionalTokens;
6602
6604
  if (wordSpacingStart > 0) {
6603
6605
  const leftText = customTextFragment.substring(0, wordSpacingStart);
6604
- this.renderText(fragment, textStyle, leftText, null, [CUSTOM_TAG, 'noder-pointing'], attributes);
6606
+ this.renderText(fragment, textStyle, leftText, null, classes, attributes, style);
6605
6607
  additionalTokens += leftText.length;
6606
6608
  }
6607
6609
  const middleText = customTextFragment.substring(wordSpacingStart, wordSpacingEnd + 1);
6608
- this.renderText(fragment, textStyle, middleText, line.wordSpacing, [CUSTOM_TAG, 'noder-pointing'], attributes);
6610
+ this.renderText(fragment, textStyle, middleText, line.wordSpacing, classes, attributes, style);
6609
6611
  additionalTokens += middleText.length;
6610
6612
  if (wordSpacingEnd >= 0) {
6611
6613
  const rightText = customTextFragment.substring(wordSpacingEnd + 1);
6612
- this.renderText(fragment, textStyle, rightText, null, [CUSTOM_TAG, 'noder-pointing'], attributes);
6614
+ this.renderText(fragment, textStyle, rightText, null, classes, attributes, style);
6613
6615
  additionalTokens += rightText.length;
6614
6616
  }
6615
6617
  }
@@ -6619,7 +6621,7 @@ class RenderingHelper {
6619
6621
  }
6620
6622
  return { renderedIndexes, additionalTokens };
6621
6623
  }
6622
- static renderText(fragment, textStyle, content, wordSpacing, additionalClasses = [], additionalAttributes = []) {
6624
+ static renderText(fragment, textStyle, content, wordSpacing, additionalClasses = [], additionalAttributes = [], additionalStyle = '') {
6623
6625
  if (!content.length) {
6624
6626
  return;
6625
6627
  }
@@ -6643,7 +6645,7 @@ class RenderingHelper {
6643
6645
  span.onmouseleave = () => span.classList.remove('hyperlink-hover');
6644
6646
  }
6645
6647
  span.textContent = content;
6646
- let styleString = ContentStyleHelper.getTextStylesString(textStyle);
6648
+ let styleString = additionalStyle + ContentStyleHelper.getTextStylesString(textStyle);
6647
6649
  if (wordSpacing) {
6648
6650
  styleString += `word-spacing:${wordSpacing}px;`;
6649
6651
  }
@@ -9846,8 +9848,8 @@ class Editor {
9846
9848
  const cursor = PositionHelper.paragraphToPixel(this.session, paragraphPos.row, paragraphPos.column);
9847
9849
  const rect = this.renderer.container.getBoundingClientRect();
9848
9850
  const hintLeft = rect.left + cursor.pageX;
9849
- const hintTop = rect.top + cursor.pageY - POPUP_HEIGHT;
9850
- this.overlayService.open(GrammarPopupComponent, { error, paragraphIndex: position.row }, hintLeft - 100, hintTop);
9851
+ const hintTop = rect.top + cursor.pageY + cursor.height + 5;
9852
+ this.overlayService.open(GrammarPopupComponent, { error, paragraphIndex: position.row }, hintLeft, hintTop);
9851
9853
  event.stopPropagation();
9852
9854
  }
9853
9855
  event.preventDefault();
@@ -11018,11 +11020,12 @@ class CellResizer {
11018
11020
  this.columnPositionChanged(positionX);
11019
11021
  };
11020
11022
  }
11021
- onStartResizing(cellResizerParameters) {
11023
+ onStartResizing(cellResizerParameters, maxExpansionSpace = 0) {
11022
11024
  if (this.editorService.isViewOnly) {
11023
11025
  return;
11024
11026
  }
11025
11027
  this.cellResizerParameters = cellResizerParameters;
11028
+ this.maxExpansionSpace = maxExpansionSpace;
11026
11029
  switch (this.cellResizerParameters.cellSide) {
11027
11030
  case ResizerSide.Left:
11028
11031
  this.startResizingFromLeft();
@@ -11053,9 +11056,13 @@ class CellResizer {
11053
11056
  this.spaceLeft = this.table.columns[columnIndex].width - this.minCellWidth;
11054
11057
  this.spaceRight = 0;
11055
11058
  const nextColumnIndex = columnIndex + 1;
11059
+ const isLast = columnIndex === this.table.columns.length - 1;
11056
11060
  if (this.table.columns.length > nextColumnIndex) {
11057
11061
  this.spaceRight = this.table.columns[nextColumnIndex].width - this.minCellWidth;
11058
11062
  }
11063
+ else if (isLast) {
11064
+ this.spaceRight = this.maxExpansionSpace;
11065
+ }
11059
11066
  const cellRect = this.tableEl.rows[this.splitRowIndex].cells[this.cellResizerParameters.columnIndex].getBoundingClientRect();
11060
11067
  this.startX = this.tableEl.offsetLeft + cellRect.left + cellRect.width - this.resizerBorderSize;
11061
11068
  this.columnPositionChanged(this.startX);
@@ -11266,6 +11273,9 @@ class TableCellHelper {
11266
11273
  if (border.color && border.color !== 'auto') {
11267
11274
  style += ` ${border.color}`;
11268
11275
  }
11276
+ else {
11277
+ style += ` #000`;
11278
+ }
11269
11279
  return style;
11270
11280
  }
11271
11281
  static getBorderLineStyle(lineStyle) {
@@ -11829,11 +11839,12 @@ class NoderTableComponent extends BaseNoderComponent {
11829
11839
  this.borderSize = 1;
11830
11840
  this.startResizing = (cellResizerParameters) => {
11831
11841
  const splitRowIndex = this.getSplitRowIndex(cellResizerParameters.rowIndex);
11842
+ const availableTableSpace = this.getAvailableTableSpace();
11832
11843
  this.resizer.resizerHeight = this.getRowsHeightBetweenSplits(splitRowIndex);
11833
11844
  this.resizer.startY = this.getRowsHeightBefore(splitRowIndex);
11834
11845
  this.resizer.splitRowIndex = splitRowIndex;
11835
11846
  this.resizer.tableInsertIndex = this.insertIndex;
11836
- this.resizer.onStartResizing(cellResizerParameters);
11847
+ this.resizer.onStartResizing(cellResizerParameters, availableTableSpace);
11837
11848
  };
11838
11849
  this.cellHeightChanged = (rowIndex, cellIndex, height) => {
11839
11850
  const tableRow = this.table.rows[rowIndex];
@@ -12191,6 +12202,13 @@ class NoderTableComponent extends BaseNoderComponent {
12191
12202
  }
12192
12203
  return sum;
12193
12204
  }
12205
+ getAvailableTableSpace() {
12206
+ const parent = this.el.nativeElement.parentElement;
12207
+ if (!parent || !parent.classList.contains('noder-line')) {
12208
+ return 0;
12209
+ }
12210
+ return Math.max(0, parent.clientWidth - this.tableEl.clientWidth);
12211
+ }
12194
12212
  updateCells() {
12195
12213
  const rows = this.rowMatrix.length;
12196
12214
  const cols = rows > 0 ? this.rowMatrix[0].cells.length : 0;