@burger-editor/client 4.0.0-alpha.55 → 4.0.0-alpha.56

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/client.css CHANGED
@@ -797,8 +797,10 @@
797
797
  }
798
798
 
799
799
  :where(fieldset) {
800
+ inline-size: 100%;
800
801
  padding: 1em;
801
802
  margin-block-start: 1em;
803
+ container-type: inline-size;
802
804
  border: 1px solid var(--bge-border-color);
803
805
  border-radius: var(--border-radius);
804
806
 
package/dist/client.js CHANGED
@@ -33913,7 +33913,8 @@ activateTextOnlyMode_fn = function() {
33913
33913
  if (!__privateGet$1(this, _textOnlyContainer)) {
33914
33914
  __privateSet$1(this, _textOnlyContainer, document.createElement("div"));
33915
33915
  __privateGet$1(this, _textOnlyContainer).dataset.textOnlyEditor = "";
33916
- this.shadowRoot.querySelector("[data-bge-mode]").append(__privateGet$1(this, _textOnlyContainer));
33916
+ const modeContainer = this.shadowRoot.querySelector("[data-bge-mode]");
33917
+ modeContainer.insertBefore(__privateGet$1(this, _textOnlyContainer), __privateGet$1(this, _structureChangeMessage));
33917
33918
  }
33918
33919
  const textOnlyStyle = document.createElement("style");
33919
33920
  textOnlyStyle.dataset.textOnlyStyle = "";
@@ -34236,6 +34237,16 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElem
34236
34237
  updateButtonState(button, event.detail.state, this);
34237
34238
  }
34238
34239
  });
34240
+ __privateGet(this, _wysiwygElement).addEventListener("bge:structure-change", () => {
34241
+ const currentState = getCurrentEditorState(__privateGet(this, _wysiwygElement));
34242
+ for (const button of buttons) {
34243
+ updateButtonState(button, currentState, this);
34244
+ }
34245
+ });
34246
+ const initialState = getCurrentEditorState(__privateGet(this, _wysiwygElement));
34247
+ for (const button of buttons) {
34248
+ updateButtonState(button, initialState, this);
34249
+ }
34239
34250
  if (_BgeWysiwygEditorElement.experimentalTextOnlyMode) {
34240
34251
  const modeSelector = this.querySelector(
34241
34252
  "[data-bge-mode-selector]"
@@ -34244,23 +34255,23 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElem
34244
34255
  throw new Error("Mode selector not found");
34245
34256
  }
34246
34257
  modeSelector.value = __privateGet(this, _wysiwygElement).mode;
34247
- const initialHasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
34248
34258
  const wysiwygOption = modeSelector.querySelector(
34249
34259
  'option[value="wysiwyg"]'
34250
34260
  );
34251
- if (wysiwygOption) {
34252
- wysiwygOption.disabled = initialHasStructureChange;
34253
- }
34254
34261
  const handleStructureChange = (event) => {
34255
34262
  const hasStructureChange = event.detail.hasStructureChange;
34256
34263
  if (wysiwygOption) {
34257
34264
  wysiwygOption.disabled = hasStructureChange;
34258
34265
  }
34266
+ modeSelector.value = __privateGet(this, _wysiwygElement).mode;
34259
34267
  };
34260
34268
  __privateGet(this, _wysiwygElement).addEventListener(
34261
34269
  "bge:structure-change",
34262
34270
  handleStructureChange
34263
34271
  );
34272
+ if (wysiwygOption) {
34273
+ wysiwygOption.disabled = __privateGet(this, _wysiwygElement).hasStructureChange;
34274
+ }
34264
34275
  modeSelector.addEventListener("change", () => {
34265
34276
  if (!__privateGet(this, _wysiwygElement)) {
34266
34277
  throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
@@ -34284,10 +34295,6 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElem
34284
34295
  if (!htmlModeButton) {
34285
34296
  throw new Error("HTML mode button not found");
34286
34297
  }
34287
- const initialHasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
34288
- const initialIsHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
34289
- htmlModeButton.disabled = initialIsHtmlMode && initialHasStructureChange;
34290
- htmlModeButton.ariaPressed = initialIsHtmlMode ? "true" : "false";
34291
34298
  htmlModeButton.addEventListener("click", () => {
34292
34299
  if (!__privateGet(this, _wysiwygElement)) {
34293
34300
  throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
@@ -34309,9 +34316,12 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement extends HTMLElem
34309
34316
  });
34310
34317
  __privateGet(this, _wysiwygElement).addEventListener("bge:structure-change", (event) => {
34311
34318
  const hasStructureChange = event.detail.hasStructureChange;
34312
- const isHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
34313
- htmlModeButton.disabled = isHtmlMode && hasStructureChange;
34319
+ const isHtmlMode2 = __privateGet(this, _wysiwygElement).mode === "html";
34320
+ htmlModeButton.disabled = isHtmlMode2 && hasStructureChange;
34314
34321
  });
34322
+ const isHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
34323
+ htmlModeButton.ariaPressed = isHtmlMode ? "true" : "false";
34324
+ htmlModeButton.disabled = isHtmlMode && __privateGet(this, _wysiwygElement).hasStructureChange;
34315
34325
  }
34316
34326
  }
34317
34327
  setStyle(css) {
@@ -34469,6 +34479,9 @@ function bindToggle(button, wysiwygElement) {
34469
34479
  }
34470
34480
  function updateButtonState(button, state, editorElement) {
34471
34481
  const buttonType = button.dataset.bgeToolbarButton;
34482
+ if (!buttonType) {
34483
+ return;
34484
+ }
34472
34485
  if (buttonType === "html-mode" || buttonType === "text-only-mode") {
34473
34486
  return;
34474
34487
  }
@@ -44889,7 +44902,7 @@ function parseConfig(config) {
44889
44902
  }
44890
44903
  }
44891
44904
 
44892
- const version = "4.0.0-alpha.54";
44905
+ const version = "4.0.0-alpha.55";
44893
44906
  function attachDraftSwitcher(engine) {
44894
44907
  if (engine.hasDraft()) {
44895
44908
  const container = document.createElement("div");