@talrace/ngx-noder 19.0.60 → 19.0.61

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.
@@ -633,7 +633,13 @@ class EditorService {
633
633
  this._clipboardData$ = new BehaviorSubject('');
634
634
  this._hasSelection$ = new BehaviorSubject(false);
635
635
  this._historyInfo$ = new BehaviorSubject(new OperationsHistoryInfoModel(-1, -1));
636
- this._toggleSidenav$ = new Subject();
636
+ this._toggleSidenav$ = new BehaviorSubject({
637
+ open: false,
638
+ component: null,
639
+ focus: false,
640
+ data: null
641
+ });
642
+ this._isSidenavLocked = false;
637
643
  this._displayGrammarError$ = new Subject();
638
644
  this._applyGrammarSuggestion$ = new Subject();
639
645
  this._ignoreGrammarError$ = new Subject();
@@ -763,6 +769,9 @@ class EditorService {
763
769
  get toggleSidenav$() {
764
770
  return this._toggleSidenav$.asObservable();
765
771
  }
772
+ get isSidenavLocked() {
773
+ return this._isSidenavLocked;
774
+ }
766
775
  get displayGrammarError$() {
767
776
  return this._displayGrammarError$.asObservable();
768
777
  }
@@ -1177,8 +1186,14 @@ class EditorService {
1177
1186
  this._toggleSidenav$.next({ open: true, component, focus });
1178
1187
  }
1179
1188
  closeSidenav() {
1189
+ if (this.isSidenavLocked) {
1190
+ return;
1191
+ }
1180
1192
  this._toggleSidenav$.next({ open: false, component: null, focus: false });
1181
1193
  }
1194
+ lockSidenav(value) {
1195
+ this._isSidenavLocked = value;
1196
+ }
1182
1197
  changedTableSize(insertIndex, sessionId) {
1183
1198
  this._changedTableSize$.next({ insertIndex, sessionId });
1184
1199
  }
@@ -10075,6 +10090,7 @@ class GrammarChecker {
10075
10090
  const filteredErrors = this.filterErrors(errors);
10076
10091
  this.paragraphErrorMap.set(key, filteredErrors);
10077
10092
  session.renderer.updateGrammarHighlights(+paragraphId, filteredErrors);
10093
+ session.renderer.scheduleChanges({ grammar: true });
10078
10094
  }
10079
10095
  }
10080
10096
  destroy() {
@@ -10106,6 +10122,7 @@ class GrammarChecker {
10106
10122
  this.paragraphErrorMap.set(result.paragraphId, filteredErrors);
10107
10123
  const id = +result.paragraphId.split('-')[1];
10108
10124
  session.renderer.updateGrammarHighlights(id, filteredErrors);
10125
+ session.renderer.scheduleChanges({ grammar: true });
10109
10126
  }
10110
10127
  }
10111
10128
  processParagraphChange(session, change) {
@@ -10122,6 +10139,7 @@ class GrammarChecker {
10122
10139
  return;
10123
10140
  }
10124
10141
  this.adjustHighlights(change, session);
10142
+ session.renderer.scheduleChanges({ grammar: true });
10125
10143
  this.grammarService.updateParagraphContent(session.sessionId, change.paragraph);
10126
10144
  }
10127
10145
  adjustHighlights(changes, session) {
@@ -11058,7 +11076,6 @@ class Renderer extends EventEmitting {
11058
11076
  }
11059
11077
  updateGrammarHighlights(paragraphId, errors) {
11060
11078
  this.grammarHighlightLayer.setErrors(paragraphId, errors);
11061
- this.scheduleChanges({ grammar: true });
11062
11079
  }
11063
11080
  removeGrammarHighlights(paragraphId) {
11064
11081
  this.grammarHighlightLayer.removeParagraphHighlights(paragraphId);
@@ -14818,8 +14835,12 @@ class Selection {
14818
14835
  this.keepLinePositionX = null;
14819
14836
  }
14820
14837
  blur() {
14821
- this.focusedComponent?.instance.blur();
14838
+ if (!this.focusedComponent) {
14839
+ return;
14840
+ }
14841
+ const currentComponent = this.focusedComponent;
14822
14842
  this.focusedComponent = null;
14843
+ currentComponent.instance.blur();
14823
14844
  }
14824
14845
  placeCursor(cursor) {
14825
14846
  this.anchor = null;
@@ -16694,6 +16715,7 @@ class Editor {
16694
16715
  links: [],
16695
16716
  comments: []
16696
16717
  });
16718
+ this.editorService.lockSidenav(true);
16697
16719
  this.insertContent(insertIndex, nextElementContents);
16698
16720
  setTimeout(() => {
16699
16721
  // Need to skip micro tasks for a render element before focus
@@ -16704,6 +16726,7 @@ class Editor {
16704
16726
  this.onSelectionChange();
16705
16727
  this.scrollCursorIntoMainView();
16706
16728
  }
16729
+ this.editorService.lockSidenav(false);
16707
16730
  });
16708
16731
  }
16709
16732
  insertContent(insertIndex, contents) {
@@ -18006,7 +18029,14 @@ class EditorComponent {
18006
18029
  }
18007
18030
  toggleSidenavSubscription() {
18008
18031
  return this.editorService.toggleSidenav$.subscribe(data => {
18009
- if (this.sidenavComponentRef?.componentType === data.component) {
18032
+ const isSameComponent = this.sidenavComponentRef?.componentType === data.component;
18033
+ if (data.open && (isSameComponent || this.editorService.isSidenavLocked)) {
18034
+ const instance = this.sidenavComponentRef.instance;
18035
+ for (const [key, value] of Object.entries(data.data || {})) {
18036
+ if (key in instance) {
18037
+ this.sidenavComponentRef.setInput(key, value);
18038
+ }
18039
+ }
18010
18040
  return;
18011
18041
  }
18012
18042
  this.removeSidenavComponent();
@@ -18024,6 +18054,9 @@ class EditorComponent {
18024
18054
  this.sidenav.close().catch(() => {
18025
18055
  // continue regardless of error
18026
18056
  });
18057
+ if (this.editor.selection.isFocused) {
18058
+ this.editor.selection.blur();
18059
+ }
18027
18060
  }
18028
18061
  this.cdr.markForCheck();
18029
18062
  });