markupeditor 0.9.43 → 0.9.44

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.
@@ -34516,6 +34516,8 @@ function setStyle(style) {
34516
34516
  function setStyleCommand(style) {
34517
34517
  let commandAdapter = (viewState, dispatch, view) => {
34518
34518
  let state = view?.state ?? viewState;
34519
+ const delegate = activeConfig()?.delegate;
34520
+ if (delegate?.canStyle && !delegate.canStyle(isTableSelected(state))) return false;
34519
34521
  const protonode = _nodeFor(style, state.schema);
34520
34522
  const doc = state.doc;
34521
34523
  const selection = state.selection;
@@ -34620,6 +34622,8 @@ function setCodeLanguageCommand(language) {
34620
34622
  }
34621
34623
  return true
34622
34624
  }
34625
+ const delegate = activeConfig()?.delegate;
34626
+ if (delegate?.canStyle && !delegate.canStyle(isTableSelected(state))) return false;
34623
34627
  const codeBlockType = state.schema.nodes.code_block;
34624
34628
  const doc = state.doc;
34625
34629
  const selection = state.selection;
@@ -34812,6 +34816,8 @@ function wrapInListCommand(schema, targetNodeType, attrs) {
34812
34816
  const listItemTypes = [targetListItemType];
34813
34817
 
34814
34818
  const commandAdapter = (state, dispatch, view) => {
34819
+ const delegate = activeConfig()?.delegate;
34820
+ if (delegate?.canList && !delegate.canList(isTableSelected(state))) return false;
34815
34821
  const inTargetNodeType = getListType(state) === listTypeFor(targetNodeType, state.schema);
34816
34822
  const command = inTargetNodeType ? liftListItem(state.schema.nodes.list_item) : wrapInList(targetNodeType, attrs);
34817
34823
  if (command(state)) {
@@ -34965,6 +34971,7 @@ function indent$1() {
34965
34971
  function indentCommand() {
34966
34972
  let commandAdapter = (viewState, dispatch, view) => {
34967
34973
  let state = view?.state ?? viewState;
34974
+ if (isTableSelected(state)) return false; // Indenting wraps/re-nests blocks, which corrupts a table's structure
34968
34975
  let blockquote = state.schema.nodes.blockquote;
34969
34976
  let li = state.schema.nodes.list_item;
34970
34977
  let ul = state.schema.nodes.bullet_list;
@@ -35080,6 +35087,7 @@ function outdent$1() {
35080
35087
  function outdentCommand() {
35081
35088
  let commandAdapter = (viewState, dispatch, view) => {
35082
35089
  let state = view?.state ?? viewState;
35090
+ if (isTableSelected(state)) return false; // Outdenting lifts/re-nests blocks, which corrupts a table's structure
35083
35091
  const { $from, $to } = state.selection;
35084
35092
  let tr = state.tr;
35085
35093
  let willLift = false;
@@ -36350,10 +36358,14 @@ function insertHRule() {
36350
36358
  }
36351
36359
  function insertHRuleCommand() {
36352
36360
  const commandAdapter = (state, dispatch, view) => {
36353
- const hRuleNode = view.state.schema.nodes.horizontal_rule.create();
36354
- const transaction = view.state.tr.replaceSelectionWith(hRuleNode, true);
36355
- view.dispatch(transaction);
36356
- stateChanged(view);
36361
+ const delegate = activeConfig()?.delegate;
36362
+ if (delegate?.canInsertHRule && !delegate.canInsertHRule(isTableSelected(state))) return false;
36363
+ if (dispatch) {
36364
+ const hRuleNode = state.schema.nodes.horizontal_rule.create();
36365
+ const transaction = state.tr.replaceSelectionWith(hRuleNode, true);
36366
+ dispatch(transaction);
36367
+ stateChanged(view);
36368
+ }
36357
36369
  return true;
36358
36370
  };
36359
36371
 
@@ -40971,7 +40983,7 @@ function hRuleItem(config) {
40971
40983
  icon: icon,
40972
40984
  title: title,
40973
40985
  active: (state) => { return isHRuleSelected(state) },
40974
- enable: () => { return true } // TODO: should be conditional?
40986
+ enable: true
40975
40987
  };
40976
40988
  return cmdItem(insertHRuleCommand(), options)
40977
40989
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markupeditor",
3
- "version": "0.9.43",
3
+ "version": "0.9.44",
4
4
  "description": "A web component and API for WYSIWYG HTML editing.",
5
5
  "keywords": [
6
6
  "wysiwyg",