@amplifyup/sdk 0.1.58 → 0.1.59

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
@@ -2268,6 +2268,25 @@ Available Console Commands:
2268
2268
  return;
2269
2269
  }
2270
2270
  try {
2271
+ if (event.data?.type === "AMPLIFYUP_RICHTEXT_EDITING") {
2272
+ document.querySelectorAll(".amplifyup-richtext-editing").forEach((el) => el.classList.remove("amplifyup-richtext-editing"));
2273
+ if (event.data.active && event.data.fieldName) {
2274
+ if (!document.getElementById("amplifyup-richtext-editing-style")) {
2275
+ const style = document.createElement("style");
2276
+ style.id = "amplifyup-richtext-editing-style";
2277
+ style.textContent = "[data-amplifyup-field].amplifyup-richtext-editing{outline:none!important;visibility:hidden!important;}";
2278
+ document.head.appendChild(style);
2279
+ }
2280
+ const editRoot = event.data.layoutNodeId ? document.querySelector(
2281
+ `[data-node-id="${event.data.layoutNodeId}"], [data-amplifyup-node-id="${event.data.layoutNodeId}"]`
2282
+ ) || document : document;
2283
+ const editField = editRoot.querySelector(
2284
+ `[data-amplifyup-field="${event.data.fieldName}"]`
2285
+ );
2286
+ if (editField) editField.classList.add("amplifyup-richtext-editing");
2287
+ }
2288
+ return;
2289
+ }
2271
2290
  if (event.data?.type === "AMPLIFYUP_FIELD_PATCH") {
2272
2291
  window.dispatchEvent(
2273
2292
  new CustomEvent("amplifyup:field-patch", { detail: event.data })