@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.
@@ -1955,6 +1955,38 @@ Available Console Commands:
1955
1955
  return;
1956
1956
  }
1957
1957
  try {
1958
+ if (event.data?.type === "AMPLIFYUP_RICHTEXT_EDITING") {
1959
+ document.querySelectorAll(".amplifyup-richtext-editing").forEach((el) => {
1960
+ el.classList.remove("amplifyup-richtext-editing");
1961
+ el.style.minHeight = "";
1962
+ el.style.height = "";
1963
+ el.style.display = "";
1964
+ });
1965
+ if (event.data.active && event.data.fieldName) {
1966
+ if (!document.getElementById("amplifyup-richtext-editing-style")) {
1967
+ const style = document.createElement("style");
1968
+ style.id = "amplifyup-richtext-editing-style";
1969
+ style.textContent = "[data-amplifyup-field].amplifyup-richtext-editing{outline:none!important;visibility:hidden!important;display:block!important;box-sizing:border-box!important;}";
1970
+ document.head.appendChild(style);
1971
+ }
1972
+ const editRoot = event.data.layoutNodeId ? document.querySelector(
1973
+ `[data-node-id="${event.data.layoutNodeId}"], [data-amplifyup-node-id="${event.data.layoutNodeId}"]`
1974
+ ) || document : document;
1975
+ const editField = editRoot.querySelector(
1976
+ `[data-amplifyup-field="${event.data.fieldName}"]`
1977
+ );
1978
+ if (editField) {
1979
+ editField.classList.add("amplifyup-richtext-editing");
1980
+ const editHeight = Number(event.data.height) || 0;
1981
+ if (editHeight > 0) {
1982
+ editField.style.display = "block";
1983
+ editField.style.minHeight = `${editHeight}px`;
1984
+ editField.style.height = `${editHeight}px`;
1985
+ }
1986
+ }
1987
+ }
1988
+ return;
1989
+ }
1958
1990
  if (event.data?.type === "AMPLIFYUP_FIELD_PATCH") {
1959
1991
  window.dispatchEvent(
1960
1992
  new CustomEvent("amplifyup:field-patch", { detail: event.data })