@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.cjs CHANGED
@@ -5698,6 +5698,15 @@ function SamplesDrawer({
5698
5698
  setLoadingTemplates(false);
5699
5699
  }
5700
5700
  });
5701
+ const ensureRowPresent = (id, slug, kind, tags) => {
5702
+ const now = (/* @__PURE__ */ new Date()).toISOString();
5703
+ const row = { id, slug, kind, tags, createdAt: now, updatedAt: now };
5704
+ if (kind === "sample") {
5705
+ setSamples((prev) => prev.some((t) => t.id === id) ? prev : [...prev, row]);
5706
+ } else {
5707
+ setTemplates((prev) => prev.some((t) => t.id === id) ? prev : [...prev, row]);
5708
+ }
5709
+ };
5701
5710
  React62.useEffect(() => {
5702
5711
  if (!enabled || !loadTemplates) return;
5703
5712
  refreshTemplates();
@@ -5842,6 +5851,7 @@ function SamplesDrawer({
5842
5851
  showMessage("New template created!");
5843
5852
  window.location.hash = `#template/${id}`;
5844
5853
  yield refreshTemplates();
5854
+ ensureRowPresent(id, slug, "template");
5845
5855
  return true;
5846
5856
  } catch (e) {
5847
5857
  console.error("Error creating template:", e);
@@ -5879,6 +5889,7 @@ function SamplesDrawer({
5879
5889
  showMessage(kind === "sample" ? "New sample created" : "New template created");
5880
5890
  window.location.hash = `#template/${id}`;
5881
5891
  yield refreshTemplates();
5892
+ ensureRowPresent(id, slug, kind);
5882
5893
  return true;
5883
5894
  } catch (e) {
5884
5895
  console.error("Error creating:", e);
@@ -7004,7 +7015,7 @@ function EditorBlockWrapper({ children }) {
7004
7015
  }
7005
7016
  return /* @__PURE__ */ React62__default.default.createElement(TuneMenu, { blockId });
7006
7017
  };
7007
- const draggable = Boolean(blockParent);
7018
+ const draggable = Boolean(blockParent) && selectedBlockId !== blockId;
7008
7019
  const handleDragStart = (e) => {
7009
7020
  if (!blockParent) return;
7010
7021
  e.stopPropagation();