@kontakto/email-template-editor 2.3.0 → 2.3.1

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.
package/dist/index.js CHANGED
@@ -5687,6 +5687,15 @@ function SamplesDrawer({
5687
5687
  setLoadingTemplates(false);
5688
5688
  }
5689
5689
  });
5690
+ const ensureRowPresent = (id, slug, kind, tags) => {
5691
+ const now = (/* @__PURE__ */ new Date()).toISOString();
5692
+ const row = { id, slug, kind, tags, createdAt: now, updatedAt: now };
5693
+ if (kind === "sample") {
5694
+ setSamples((prev) => prev.some((t) => t.id === id) ? prev : [...prev, row]);
5695
+ } else {
5696
+ setTemplates((prev) => prev.some((t) => t.id === id) ? prev : [...prev, row]);
5697
+ }
5698
+ };
5690
5699
  useEffect(() => {
5691
5700
  if (!enabled || !loadTemplates) return;
5692
5701
  refreshTemplates();
@@ -5831,6 +5840,7 @@ function SamplesDrawer({
5831
5840
  showMessage("New template created!");
5832
5841
  window.location.hash = `#template/${id}`;
5833
5842
  yield refreshTemplates();
5843
+ ensureRowPresent(id, slug, "template");
5834
5844
  return true;
5835
5845
  } catch (e) {
5836
5846
  console.error("Error creating template:", e);
@@ -5868,6 +5878,7 @@ function SamplesDrawer({
5868
5878
  showMessage(kind === "sample" ? "New sample created" : "New template created");
5869
5879
  window.location.hash = `#template/${id}`;
5870
5880
  yield refreshTemplates();
5881
+ ensureRowPresent(id, slug, kind);
5871
5882
  return true;
5872
5883
  } catch (e) {
5873
5884
  console.error("Error creating:", e);
@@ -6993,7 +7004,7 @@ function EditorBlockWrapper({ children }) {
6993
7004
  }
6994
7005
  return /* @__PURE__ */ React62.createElement(TuneMenu, { blockId });
6995
7006
  };
6996
- const draggable = Boolean(blockParent);
7007
+ const draggable = Boolean(blockParent) && selectedBlockId !== blockId;
6997
7008
  const handleDragStart = (e) => {
6998
7009
  if (!blockParent) return;
6999
7010
  e.stopPropagation();