PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/QuickEdit/components/BlockTextEditor.jsx +6 -31 3.1.03.2.1 View file →
@@ -86,8 +86,9 @@
86 86 return requiredBlocksAvailable();
87 87 };
88 88 ensureRegistered();
89 89
90 +import { track } from '@shared/lib/track';
90 91 import { parse, serialize } from '@wordpress/blocks';
91 92 import { Popover } from '@wordpress/components';
92 93 import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
93 94 import { createPortal, useEffect, useRef, useState } from '@wordpress/element';
@@ -101,9 +102,8 @@
101 102 } from '../lib/block-source-cache';
102 103 import { splice } from '../lib/dom';
103 104 import { friendlyMessage } from '../lib/errors';
104 105 import { normalizedTextEquals, textFingerprint } from '../lib/fingerprint';
105 -import { track } from '../lib/insights';
106 106 import { fetchLinkSuggestions } from '../lib/link-suggestions';
107 107 import { registerSaver, unregisterSaver } from '../lib/save-bridge';
108 108 import { useQuickEditStore } from '../state/store';
109 109 import { pushUndo } from '../state/undo';
@@ -697,41 +697,23 @@
697 697 document.addEventListener('keydown', onKey, true);
698 698 return () => document.removeEventListener('keydown', onKey, true);
699 699 }, [clearSelected, host]);
700 700
701 - // `alsoClear` lets cross-block click trigger save without racing the
702 - // new block's `setSelected(B)` — save runs to completion against A's
703 - // snapshotted data, but doesn't try to nullify the slot at the end.
704 - const handleSave = async ({ alsoClear = true } = {}) => {
701 + const handleSave = async () => {
705 702 if (saving) return;
706 703 if (!blocks) {
707 - if (alsoClear) clearSelected();
704 + clearSelected();
708 705 return;
709 706 }
710 707 // Move focus off the Save button before it disables so focus isn't
711 708 // stranded on a disabled control; the status node then announces
712 - // "Saving…" politely. Cross-block saves leave focus on the new block.
713 - if (alsoClear) statusRef.current?.focus({ preventScroll: true });
709 + // "Saving…" politely.
710 + statusRef.current?.focus({ preventScroll: true });
714 711 setSaving(true);
715 712 setSaveError(null);
716 713 const snap = selected;
717 714 const beforeRawBlock = beforeRawBlockRef.current;
718 - // Capture before the optimistic write below mutates snap.el's text.
719 715 const fingerprint = textFingerprint(snap.el);
720 - // Cross-block click unmounts the canvas before save's splice lands,
721 - // so the live element's pre-edit text briefly flashes back into view.
722 - // Pre-write the canvas editable's content into the live element so
723 - // the unmount reveal already shows the edits. Snapshot the original
724 - // so we can revert if save fails. Only text-content optimism — tag /
725 - // wrapper changes still rely on splice (see plan).
726 - let preEditInnerHtml = null;
727 - if (!alsoClear && host && snap.el) {
728 - const editable = host.querySelector('.block-editor-rich-text__editable');
729 - if (editable) {
730 - preEditInnerHtml = snap.el.innerHTML;
731 - snap.el.innerHTML = editable.innerHTML;
732 - }
733 - }
734 716 try {
735 717 const rawBlock = serialize(blocks);
736 718 const res = await save({
737 719 source: snap.source,
@@ -753,17 +735,10 @@
753 735 rawBlock: beforeRawBlock,
754 736 });
755 737 }
756 738 track('save', { kind: 'block', blockType: snap.blockType });
757 - if (alsoClear) {
758 - clearSelected();
759 - } else {
760 - setSaving(false);
761 - }
739 + clearSelected();
762 740 } catch (err) {
763 - if (preEditInnerHtml !== null && snap.el) {
764 - snap.el.innerHTML = preEditInnerHtml;
765 - }
766 741 track('save_failed', {
767 742 kind: 'block',
768 743 blockType: snap.blockType,
769 744 reason: err?.status || err?.message,