GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(live-preview): keep CM edits from being undone by stale md viewer… · phcode-dev/phoenix@f2f2382

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/extensionsIntegrated/Phoenix-live-preview
    • MarkdownSync.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/extensionsIntegrated/Phoenix-live-preview/MarkdownSync.js‎

Copy file name to clipboardExpand all lines: src/extensionsIntegrated/Phoenix-live-preview/MarkdownSync.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ define(function (require, exports, module) {
272272
}
273273
clearTimeout(_debounceTimer);
274274
_debounceTimer = setTimeout(function () {
275+
_debounceTimer = null;
275276
_sendUpdate(_lastChangeOrigin);
276277
_lastChangeOrigin = null;
277278
}, DEBOUNCE_TO_IFRAME_MS);
@@ -359,6 +360,7 @@ define(function (require, exports, module) {
359360
}
360361

361362
clearTimeout(_debounceTimer);
363+
_debounceTimer = null;
362364
clearTimeout(_scrollSyncTimer);
363365
clearTimeout(_selectionSyncTimer);
364366

@@ -672,6 +674,15 @@ define(function (require, exports, module) {
672674
return;
673675
}
674676

677+
// A CM change is still waiting to go to the iframe, so the iframe made this
678+
// before it had that change: applying it would undo the change. The pending
679+
// update brings the iframe up to date instead. (e.g. the iframe flushes its
680+
// own debounced edit when the same file is switched to again, and that can
681+
// land just after the user's next CM edit.)
682+
if (_debounceTimer) {
683+
return;
684+
}
685+
675686
const markdown = data.markdown;
676687
const remoteSyncId = data._syncId;
677688

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.