markstream-angular 2.0.1 → 2.0.4

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.
@@ -1100,6 +1100,12 @@ class CodeBlockNodeComponent {
1100
1100
  this.destroyed = false;
1101
1101
  this.copyTimer = null;
1102
1102
  this.deferredHeightSyncRaf = null;
1103
+ this.hasEditorInput = false;
1104
+ this.lastEditorIsDiff = false;
1105
+ this.lastEditorOriginalCode = '';
1106
+ this.lastEditorResolvedCode = '';
1107
+ this.lastEditorLanguage = '';
1108
+ this.lastEditorShowLoadingPlaceholder = false;
1103
1109
  this.lastRuntimeHostKey = '';
1104
1110
  this.closeInlinePreview = () => {
1105
1111
  this.inlinePreviewOpen = false;
@@ -1326,13 +1332,31 @@ class CodeBlockNodeComponent {
1326
1332
  themes[1],
1327
1333
  this.resolvedShowLineNumbers ? 'lines' : 'no-lines',
1328
1334
  ].join('\u0000');
1329
- if (nextOptions !== this.lastCodeBlockOptions || runtimeHostKey !== this.lastRuntimeHostKey) {
1335
+ const runtimeChanged = nextOptions !== this.lastCodeBlockOptions || runtimeHostKey !== this.lastRuntimeHostKey;
1336
+ if (runtimeChanged) {
1330
1337
  this.lastCodeBlockOptions = nextOptions;
1331
1338
  this.lastRuntimeHostKey = runtimeHostKey;
1332
1339
  this.disposeRuntimeHelpers();
1333
1340
  }
1341
+ const isDiff = this.isDiff;
1342
+ const originalCode = this.originalCode;
1343
+ const resolvedCode = this.resolvedCode;
1344
+ const language = this.language;
1345
+ const showLoadingPlaceholder = this.showLoadingPlaceholder;
1346
+ const editorInputChanged = !this.hasEditorInput
1347
+ || isDiff !== this.lastEditorIsDiff
1348
+ || originalCode !== this.lastEditorOriginalCode
1349
+ || resolvedCode !== this.lastEditorResolvedCode
1350
+ || language !== this.lastEditorLanguage
1351
+ || showLoadingPlaceholder !== this.lastEditorShowLoadingPlaceholder;
1352
+ this.hasEditorInput = true;
1353
+ this.lastEditorIsDiff = isDiff;
1354
+ this.lastEditorOriginalCode = originalCode;
1355
+ this.lastEditorResolvedCode = resolvedCode;
1356
+ this.lastEditorLanguage = language;
1357
+ this.lastEditorShowLoadingPlaceholder = showLoadingPlaceholder;
1334
1358
  this.applyInitialFontSize();
1335
- if (!this.viewReady)
1359
+ if (!this.viewReady || (!runtimeChanged && !editorInputChanged))
1336
1360
  return;
1337
1361
  void this.syncEditorState();
1338
1362
  }