@amplifyup/sdk 0.1.58 → 0.1.60

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,38 @@ 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) => {
2273
+ el.classList.remove("amplifyup-richtext-editing");
2274
+ el.style.minHeight = "";
2275
+ el.style.height = "";
2276
+ el.style.display = "";
2277
+ });
2278
+ if (event.data.active && event.data.fieldName) {
2279
+ if (!document.getElementById("amplifyup-richtext-editing-style")) {
2280
+ const style = document.createElement("style");
2281
+ style.id = "amplifyup-richtext-editing-style";
2282
+ style.textContent = "[data-amplifyup-field].amplifyup-richtext-editing{outline:none!important;visibility:hidden!important;display:block!important;box-sizing:border-box!important;}";
2283
+ document.head.appendChild(style);
2284
+ }
2285
+ const editRoot = event.data.layoutNodeId ? document.querySelector(
2286
+ `[data-node-id="${event.data.layoutNodeId}"], [data-amplifyup-node-id="${event.data.layoutNodeId}"]`
2287
+ ) || document : document;
2288
+ const editField = editRoot.querySelector(
2289
+ `[data-amplifyup-field="${event.data.fieldName}"]`
2290
+ );
2291
+ if (editField) {
2292
+ editField.classList.add("amplifyup-richtext-editing");
2293
+ const editHeight = Number(event.data.height) || 0;
2294
+ if (editHeight > 0) {
2295
+ editField.style.display = "block";
2296
+ editField.style.minHeight = `${editHeight}px`;
2297
+ editField.style.height = `${editHeight}px`;
2298
+ }
2299
+ }
2300
+ }
2301
+ return;
2302
+ }
2271
2303
  if (event.data?.type === "AMPLIFYUP_FIELD_PATCH") {
2272
2304
  window.dispatchEvent(
2273
2305
  new CustomEvent("amplifyup:field-patch", { detail: event.data })