@bitcobblers/wod-wiki-ui 0.59.2238 → 0.59.2243

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.
@@ -11849,13 +11849,27 @@ function saveWidgetSource(view, sectionId, markdown2) {
11849
11849
  message: "Unable to locate widget source in the editor."
11850
11850
  };
11851
11851
  }
11852
- view.dispatch({
11853
- changes: {
11854
- from: section.contentFrom,
11855
- to: section.contentTo,
11856
- insert: normalizeWidgetMarkdown(markdown2)
11852
+ const dispatchChange = () => {
11853
+ if (view.state.readOnly) return;
11854
+ const latest = findWidgetSection(view, sectionId);
11855
+ if (!latest || latest.contentFrom == null || latest.contentTo == null) return;
11856
+ view.dispatch({
11857
+ changes: {
11858
+ from: latest.contentFrom,
11859
+ to: latest.contentTo,
11860
+ insert: normalizeWidgetMarkdown(markdown2)
11861
+ }
11862
+ });
11863
+ };
11864
+ try {
11865
+ dispatchChange();
11866
+ } catch (err) {
11867
+ if (err instanceof Error && /update.*in progress/i.test(err.message)) {
11868
+ queueMicrotask(dispatchChange);
11869
+ } else {
11870
+ throw err;
11857
11871
  }
11858
- });
11872
+ }
11859
11873
  return parsed;
11860
11874
  }
11861
11875
  function renderMissingWidget(widgetName) {