@phuong-tran-redoc/document-engine-angular 0.0.31 → 0.0.32
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.
|
@@ -4781,6 +4781,7 @@ class EditorBubbleMenuComponent {
|
|
|
4781
4781
|
currentAttributes = {};
|
|
4782
4782
|
cleanupSelection = null;
|
|
4783
4783
|
shouldShowImpl = null;
|
|
4784
|
+
viewReady = false;
|
|
4784
4785
|
keyToSignal = new Map();
|
|
4785
4786
|
forceOpen = { value: false };
|
|
4786
4787
|
documentClickHandler;
|
|
@@ -4816,6 +4817,7 @@ class EditorBubbleMenuComponent {
|
|
|
4816
4817
|
this.addDocumentClickHandler();
|
|
4817
4818
|
}
|
|
4818
4819
|
ngAfterViewInit() {
|
|
4820
|
+
this.viewReady = true;
|
|
4819
4821
|
// const bubbleElement = this.bubbleElement?.nativeElement;
|
|
4820
4822
|
// if (bubbleElement) {
|
|
4821
4823
|
// this.focusTrap.attach(bubbleElement);
|
|
@@ -4890,6 +4892,9 @@ class EditorBubbleMenuComponent {
|
|
|
4890
4892
|
* Handle when target mark/node becomes active
|
|
4891
4893
|
*/
|
|
4892
4894
|
handleActivate(attrs) {
|
|
4895
|
+
if (!this.viewReady) {
|
|
4896
|
+
return;
|
|
4897
|
+
}
|
|
4893
4898
|
this.currentAttributes = attrs;
|
|
4894
4899
|
// Select which view to show
|
|
4895
4900
|
const viewId = this.selectInitialView(attrs, false);
|
|
@@ -6131,6 +6136,7 @@ class TiptapEditorDirective {
|
|
|
6131
6136
|
_editor;
|
|
6132
6137
|
initialEditableState;
|
|
6133
6138
|
set editor(editor) {
|
|
6139
|
+
console.log('set editor', editor);
|
|
6134
6140
|
this._editor = editor;
|
|
6135
6141
|
// Store initial editable state immediately when editor is set
|
|
6136
6142
|
// This ensures we capture the state before any Forms API calls
|
|
@@ -6159,6 +6165,7 @@ class TiptapEditorDirective {
|
|
|
6159
6165
|
if (typeof value === 'string' && this.htmlPreprocessor) {
|
|
6160
6166
|
processedValue = this.htmlPreprocessor(value);
|
|
6161
6167
|
}
|
|
6168
|
+
console.log('writeValue', value);
|
|
6162
6169
|
this.editor.chain().setContent(processedValue, { emitUpdate: false }).run();
|
|
6163
6170
|
}
|
|
6164
6171
|
// Registers a callback function that is called when the control's value changes in the UI.
|
|
@@ -6184,9 +6191,9 @@ class TiptapEditorDirective {
|
|
|
6184
6191
|
this.renderer.setProperty(this.elRef.nativeElement, 'disabled', isDisabled);
|
|
6185
6192
|
}
|
|
6186
6193
|
handleChange = ({ editor, transaction }) => {
|
|
6187
|
-
|
|
6194
|
+
console.log('handleChange', transaction.docChanged);
|
|
6195
|
+
if (!transaction.docChanged)
|
|
6188
6196
|
return;
|
|
6189
|
-
}
|
|
6190
6197
|
// Needed for ChangeDetectionStrategy.OnPush to get notified about changes
|
|
6191
6198
|
this.changeDetectorRef.markForCheck();
|
|
6192
6199
|
if (this.outputFormat === 'html') {
|
|
@@ -6199,6 +6206,7 @@ class TiptapEditorDirective {
|
|
|
6199
6206
|
const editor = this.editor;
|
|
6200
6207
|
// take the inner contents and clear the block
|
|
6201
6208
|
const { innerHTML } = this.elRef.nativeElement;
|
|
6209
|
+
console.log('inner html', innerHTML);
|
|
6202
6210
|
this.elRef.nativeElement.innerHTML = '';
|
|
6203
6211
|
// insert the editor in the dom
|
|
6204
6212
|
this.elRef.nativeElement.append(...Array.from(editor.options.element?.childNodes || []));
|
|
@@ -6214,6 +6222,7 @@ class TiptapEditorDirective {
|
|
|
6214
6222
|
editor.on('blur', () => {
|
|
6215
6223
|
this.onTouched();
|
|
6216
6224
|
});
|
|
6225
|
+
console.log('Update change!');
|
|
6217
6226
|
// register update handler to listen to changes on update
|
|
6218
6227
|
editor.on('update', this.handleChange);
|
|
6219
6228
|
// Needed for ChangeDetectionStrategy.OnPush to get notified
|