markupeditor 0.9.10 → 0.9.12

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.
@@ -48,6 +48,29 @@
48
48
  "header": true,
49
49
  "border": true
50
50
  },
51
+ "help": {
52
+ "style": "Set paragraph style",
53
+ "bold": "Toggle bold",
54
+ "italic": "Toggle italic",
55
+ "underline": "Toggle underline",
56
+ "code": "Toggle code",
57
+ "strikethrough": "Toggle strikethrough",
58
+ "subscript": "Toggle subscript",
59
+ "superscript": "Toggle superscript",
60
+ "bullet": "Toggle bulleted list",
61
+ "number": "Toggle numbered list",
62
+ "indent": "Increase indent",
63
+ "outdent": "Decrease indent",
64
+ "link": "Insert/edit link",
65
+ "image": "Insert/edit image",
66
+ "table": "Insert/edit table",
67
+ "search": "Toggle search",
68
+ "searchForward": "Search forward",
69
+ "searchBackward": "Search backward",
70
+ "matchCase": "Match case",
71
+ "undo": "Undo",
72
+ "redo": "Redo"
73
+ },
51
74
  "augmentation": {
52
75
  "prepend": null,
53
76
  "append": null
@@ -14767,6 +14767,7 @@ let baseNodes = OrderedMap.from({
14767
14767
  div: {
14768
14768
  content: "block*",
14769
14769
  group: "block",
14770
+ isolating: true, // Prevent operations like lift from going outside of a div
14770
14771
  selectable: false,
14771
14772
  attrs: {
14772
14773
  id: {default: null},
@@ -14841,9 +14842,14 @@ let baseNodes = OrderedMap.from({
14841
14842
  }
14842
14843
  }
14843
14844
  }],
14844
- toDOM(node) {
14845
- let {id, cssClass} = node.attrs;
14846
- return ["button", { id: id, class: cssClass }, 0]
14845
+ toDOM(node) {
14846
+ let {id, cssClass, label} = node.attrs;
14847
+ const button = document.createElement("button");
14848
+ if (id) button.setAttribute("id", id);
14849
+ if (cssClass) button.setAttribute("class", cssClass);
14850
+ button.setAttribute("type", "button");
14851
+ if (label) button.innerHTML = label;
14852
+ return button;
14847
14853
  }
14848
14854
  }
14849
14855
 
@@ -17069,7 +17075,7 @@ function _buttonGroupDiv(buttonGroupJSON) {
17069
17075
  buttonGroupDiv.setAttribute('editable', "false"); // Hardcode
17070
17076
  buttonGroup.buttons.forEach( buttonAttributes => {
17071
17077
  let button = document.createElement('button');
17072
- button.appendChild(document.createTextNode(buttonAttributes.label));
17078
+ button.innerHTML = buttonAttributes.label;
17073
17079
  button.setAttribute('label', buttonAttributes.label);
17074
17080
  button.setAttribute('type', 'button');
17075
17081
  button.setAttribute('id', buttonAttributes.id);
@@ -17126,7 +17132,7 @@ function addButton(id, parentId, cssClass, label) {
17126
17132
  button.setAttribute('parentId', parentId);
17127
17133
  button.setAttribute('class', cssClass);
17128
17134
  button.setAttribute('type', 'button');
17129
- button.appendChild(document.createTextNode(label));
17135
+ button.innerHTML = label;
17130
17136
  const buttonSlice = _sliceFromElement(button);
17131
17137
  const buttonNode = buttonNodeType.create({id, parentId, cssClass, label}, buttonSlice.content);
17132
17138
  const transaction = view.state.tr;
@@ -19586,6 +19592,29 @@ var tableMenu = {
19586
19592
  header: true,
19587
19593
  border: true
19588
19594
  };
19595
+ var help = {
19596
+ style: "Set paragraph style",
19597
+ bold: "Toggle bold",
19598
+ italic: "Toggle italic",
19599
+ underline: "Toggle underline",
19600
+ code: "Toggle code",
19601
+ strikethrough: "Toggle strikethrough",
19602
+ subscript: "Toggle subscript",
19603
+ superscript: "Toggle superscript",
19604
+ bullet: "Toggle bulleted list",
19605
+ number: "Toggle numbered list",
19606
+ indent: "Increase indent",
19607
+ outdent: "Decrease indent",
19608
+ link: "Insert/edit link",
19609
+ image: "Insert/edit image",
19610
+ table: "Insert/edit table",
19611
+ search: "Toggle search",
19612
+ searchForward: "Search forward",
19613
+ searchBackward: "Search backward",
19614
+ matchCase: "Match case",
19615
+ undo: "Undo",
19616
+ redo: "Redo"
19617
+ };
19589
19618
  var augmentation = {
19590
19619
  prepend: null,
19591
19620
  append: null
@@ -19622,6 +19651,7 @@ var toolbarConfig = {
19622
19651
  styleMenu: styleMenu,
19623
19652
  styleBar: styleBar,
19624
19653
  tableMenu: tableMenu,
19654
+ help: help,
19625
19655
  augmentation: augmentation,
19626
19656
  icons: icons
19627
19657
  };
@@ -21434,10 +21464,11 @@ class LinkItem extends DialogItem {
21434
21464
  super(config);
21435
21465
  let keymap = this.config.keymap;
21436
21466
  let icons = config.toolbar.icons;
21467
+ let help = config.toolbar.help;
21437
21468
  let options = {
21438
21469
  enable: () => { return true }, // Always enabled because it is presented modally
21439
21470
  active: (state) => { return markActive(state, state.schema.marks.link) },
21440
- title: 'Insert/edit link' + keyString('link', keymap),
21471
+ title: help.link + keyString('link', keymap),
21441
21472
  icon: icons.link
21442
21473
  };
21443
21474
 
@@ -21749,10 +21780,11 @@ class ImageItem extends DialogItem {
21749
21780
  constructor(config) {
21750
21781
  super(config);
21751
21782
  let icons = config.toolbar.icons;
21783
+ let help = config.toolbar.help;
21752
21784
  let options = {
21753
21785
  enable: () => { return true }, // Always enabled because it is presented modally
21754
21786
  active: (state) => { return getImageAttributes(state).src },
21755
- title: 'Insert/edit image' + keyString('image', config.keymap),
21787
+ title: help.image + keyString('image', config.keymap),
21756
21788
  icon: icons.image
21757
21789
  };
21758
21790
 
@@ -22166,10 +22198,11 @@ class SearchItem {
22166
22198
  constructor(config) {
22167
22199
  let keymap = config.keymap;
22168
22200
  this.icons = config.toolbar.icons;
22201
+ this.help = config.toolbar.help;
22169
22202
  let options = {
22170
22203
  enable: () => { return true },
22171
22204
  active: () => { return this.showing() },
22172
- title: 'Toggle search' + keyString('search', keymap),
22205
+ title: this.help.search + keyString('search', keymap),
22173
22206
  icon: this.icons.search,
22174
22207
  id: prefix + '-searchitem'
22175
22208
  };
@@ -22293,11 +22326,11 @@ class SearchItem {
22293
22326
 
22294
22327
  // The searchBackward and searchForward buttons don't need updating
22295
22328
  let searchBackward = this.searchBackwardCommand.bind(this);
22296
- let searchBackwardItem = cmdItem(searchBackward, {title: "Search backward", icon: this.icons.searchBackward});
22329
+ let searchBackwardItem = cmdItem(searchBackward, {title: this.help.searchBackward, icon: this.icons.searchBackward});
22297
22330
  let searchBackwardDom = searchBackwardItem.render(view).dom;
22298
22331
  let searchBackwardSpan = crelt("span", {class: prefix + "-menuitem"}, searchBackwardDom);
22299
22332
  let searchForward = this.searchForwardCommand.bind(this);
22300
- let searchForwardItem = cmdItem(searchForward, {title: "Search forward", icon: this.icons.searchForward});
22333
+ let searchForwardItem = cmdItem(searchForward, {title: this.help.searchForward, icon: this.icons.searchForward});
22301
22334
  let searchForwardDom = searchForwardItem.render(view).dom;
22302
22335
  let searchForwardSpan = crelt("span", {class: prefix + "-menuitem"}, searchForwardDom);
22303
22336
  let separator = crelt("span", {class: prefix + "-menuseparator"});
@@ -22309,7 +22342,7 @@ class SearchItem {
22309
22342
  let toggleMatchCase = this.toggleMatchCaseCommand.bind(this);
22310
22343
  this.matchCaseItem = cmdItem(
22311
22344
  toggleMatchCase, {
22312
- title: "Match case",
22345
+ title: this.help.matchCase,
22313
22346
  icon: this.icons.matchCase,
22314
22347
  enable: () => {return true},
22315
22348
  active: () => {return this.caseSensitive}
@@ -22493,7 +22526,8 @@ function markActive(state, type) {
22493
22526
  * @returns string
22494
22527
  */
22495
22528
  function keyString(itemName, keymap) {
22496
- return ' (' + baseKeyString(itemName, keymap) + ')'
22529
+ let base = baseKeyString(itemName, keymap);
22530
+ return (base.length > 0) ? ' (' + base + ')' : ''
22497
22531
  }
22498
22532
 
22499
22533
  function baseKeyString(itemName, keymap) {
@@ -22769,6 +22803,7 @@ function insertBarItems(config) {
22769
22803
 
22770
22804
  function tableMenuItems(config) {
22771
22805
  let icons = config.toolbar.icons;
22806
+ let help = config.toolbar.help;
22772
22807
  let items = [];
22773
22808
  let { header, border } = config.toolbar.tableMenu;
22774
22809
  items.push(new TableCreateSubmenu({title: 'Insert table', label: 'Insert'}));
@@ -22812,7 +22847,7 @@ function tableMenuItems(config) {
22812
22847
  enable: (state) => { return isTableSelected(state) }
22813
22848
  }));
22814
22849
  }
22815
- return new Dropdown(items, { title: 'Insert/edit table', icon: icons.table })
22850
+ return new Dropdown(items, { title: help.table, icon: icons.table })
22816
22851
  }
22817
22852
 
22818
22853
  function tableEditItem(command, options) {
@@ -22848,25 +22883,26 @@ function tableBorderItem(command, options) {
22848
22883
  function styleBarItems(config, schema) {
22849
22884
  let keymap = config.keymap;
22850
22885
  let icons = config.toolbar.icons;
22886
+ let help = config.toolbar.help;
22851
22887
  let items = [];
22852
22888
  let { list, dent } = config.toolbar.styleBar;
22853
22889
  if (list) {
22854
22890
  let bullet = toggleListItem(
22855
22891
  schema,
22856
22892
  schema.nodes.bullet_list,
22857
- { title: 'Toggle bulleted list' + keyString('bullet', keymap), icon: icons.bulletList }
22893
+ { title: help.bullet + keyString('bullet', keymap), icon: icons.bulletList }
22858
22894
  );
22859
22895
  let number = toggleListItem(
22860
22896
  schema,
22861
22897
  schema.nodes.ordered_list,
22862
- { title: 'Toggle numbered list' + keyString('number', keymap), icon: icons.orderedList }
22898
+ { title: help.number + keyString('number', keymap), icon: icons.orderedList }
22863
22899
  );
22864
22900
  items.push(bullet);
22865
22901
  items.push(number);
22866
22902
  }
22867
22903
  if (dent) {
22868
- let indent = indentItem({ title: 'Increase indent' + keyString('indent', keymap), icon: icons.blockquote });
22869
- let outdent = outdentItem({ title: 'Decrease indent' + keyString('outdent', keymap), icon: icons.lift });
22904
+ let indent = indentItem({ title: help.indent + keyString('indent', keymap), icon: icons.blockquote });
22905
+ let outdent = outdentItem({ title: help.outdent + keyString('outdent', keymap), icon: icons.lift });
22870
22906
  items.push(indent);
22871
22907
  items.push(outdent);
22872
22908
  }
@@ -22916,15 +22952,16 @@ function outdentItem(options) {
22916
22952
  function formatItems(config, schema) {
22917
22953
  let keymap = config.keymap;
22918
22954
  let icons = config.toolbar.icons;
22955
+ let help = config.toolbar.help;
22919
22956
  let items = [];
22920
22957
  let { bold, italic, underline, code, strikethrough, subscript, superscript } = config.toolbar.formatBar;
22921
- if (bold) items.push(formatItem(schema.marks.strong, 'B', { title: 'Toggle bold' + keyString('bold', keymap), icon: icons.strong }));
22922
- if (italic) items.push(formatItem(schema.marks.em, 'I', { title: 'Toggle italic' + keyString('italic', keymap), icon: icons.em }));
22923
- if (underline) items.push(formatItem(schema.marks.u, 'U', { title: 'Toggle underline' + keyString('underline', keymap), icon: icons.u }));
22924
- if (code) items.push(formatItem(schema.marks.code, 'CODE', { title: 'Toggle code' + keyString('code', keymap), icon: icons.code }));
22925
- if (strikethrough) items.push(formatItem(schema.marks.s, 'DEL', { title: 'Toggle strikethrough' + keyString('strikethrough', keymap), icon: icons.s }));
22926
- if (subscript) items.push(formatItem(schema.marks.sub, 'SUB', { title: 'Toggle subscript' + keyString('subscript', keymap), icon: icons.sub }));
22927
- if (superscript) items.push(formatItem(schema.marks.sup, 'SUP', { title: 'Toggle superscript' + keyString('superscript', keymap), icon: icons.sup }));
22958
+ if (bold) items.push(formatItem(schema.marks.strong, 'B', { title: help.bold + keyString('bold', keymap), icon: icons.strong }));
22959
+ if (italic) items.push(formatItem(schema.marks.em, 'I', { title: help.italic + keyString('italic', keymap), icon: icons.em }));
22960
+ if (underline) items.push(formatItem(schema.marks.u, 'U', { title: help.underline + keyString('underline', keymap), icon: icons.u }));
22961
+ if (code) items.push(formatItem(schema.marks.code, 'CODE', { title: help.code + keyString('code', keymap), icon: icons.code }));
22962
+ if (strikethrough) items.push(formatItem(schema.marks.s, 'DEL', { title: help.strikethrough + keyString('strikethrough', keymap), icon: icons.s }));
22963
+ if (subscript) items.push(formatItem(schema.marks.sub, 'SUB', { title: help.subscript + keyString('subscript', keymap), icon: icons.sub }));
22964
+ if (superscript) items.push(formatItem(schema.marks.sup, 'SUP', { title: help.superscript + keyString('superscript', keymap), icon: icons.sup }));
22928
22965
  return items;
22929
22966
  }
22930
22967
 
@@ -22948,6 +22985,7 @@ function formatItem(markType, markName, options) {
22948
22985
  */
22949
22986
  function styleMenuItems(config, schema) {
22950
22987
  let keymap = config.keymap;
22988
+ let help = config.toolbar.help;
22951
22989
  let items = [];
22952
22990
  let { p, h1, h2, h3, h4, h5, h6, pre } = config.toolbar.styleMenu;
22953
22991
  if (p) items.push(new ParagraphStyleItem(schema.nodes.paragraph, 'P', { label: p, keymap: baseKeyString('p', keymap) }));
@@ -22968,10 +23006,10 @@ function styleMenuItems(config, schema) {
22968
23006
  return label ? (multiple ? label + '+' : label) : styleElement
22969
23007
  };
22970
23008
  let allLabels = [p, h1, h2, h3, h4, h5, h6, pre].filter(Boolean).flatMap(l => [l, l + '+']);
22971
- return [new Dropdown(items, { title: 'Set paragraph style', label: 'Style', titleUpdate: titleUpdate, labels: allLabels})]
23009
+ return [new Dropdown(items, { title: help.style, label: 'Style', titleUpdate: titleUpdate, labels: allLabels})]
22972
23010
  } else {
22973
23011
  let icons = config.toolbar.icons;
22974
- return [new Dropdown(items, { title: 'Set paragraph style', icon: icons.paragraphStyle })]
23012
+ return [new Dropdown(items, { title: help.style, icon: icons.paragraphStyle })]
22975
23013
  }
22976
23014
  }
22977
23015
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markupeditor",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "description": "A web component and API for WYSIWYG HTML editing.",
5
5
  "keywords": [
6
6
  "wysiwyg",