tinymce-rails 4.2.6 → 4.2.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfd48724e15eefba82391544f75bb9a2b55433ba
4
- data.tar.gz: 7459e400b6c4aebd2d3acb20898c5f4b75c964fc
3
+ metadata.gz: 10bc82ca39642df966ad7722419a540188e97a39
4
+ data.tar.gz: e000d80db3c71c977af60ab9e8d3e445ca33cb80
5
5
  SHA512:
6
- metadata.gz: 096af913603a040edd71eb3cc0dc9522ce5bf36fd84475f03e7e6f12f8851c811e3995ff6d326a8424ca1d76a33da15ec4561a2382c5c117c8ee40475b7dd075
7
- data.tar.gz: 4f81059cd13c921d2120ea8086b410fca03681334b5e2a7fc5fb1f41572ad9525e296b5e8b01f2bc1219519e08f731f3269b4da7356b92e037849dd5ee9ca87d
6
+ metadata.gz: ea703c2b4cbb1ec5cc807ac4eba239ac5249f871e2b52ad275bca8a1058f931a167812d1433450b6f25ba7967c9fb3d07385bcaa9878b0e785b0227005d924fc
7
+ data.tar.gz: 4178bd6f00e89829657fd1b927c7b9f51835fb0f1c87f6af9b3af732ea62e4b057563b29bfa4198516f6edddcd67214c18b6e46f7cfd4ca614fbe09b4f3243b6
@@ -1,4 +1,4 @@
1
- // 4.2.6 (2015-09-28)
1
+ // 4.2.7 (2015-10-27)
2
2
 
3
3
  /**
4
4
  * Compiled inline version. (Library mode)
@@ -4376,7 +4376,7 @@ define("tinymce/html/Entities", [
4376
4376
 
4377
4377
  var Entities = {
4378
4378
  /**
4379
- * Encodes the specified string using raw entities. This means only the required XML base entities will be endoded.
4379
+ * Encodes the specified string using raw entities. This means only the required XML base entities will be encoded.
4380
4380
  *
4381
4381
  * @method encodeRaw
4382
4382
  * @param {String} text Text to encode.
@@ -4818,6 +4818,27 @@ define("tinymce/dom/DOMUtils", [
4818
4818
  $elm.attr('data-mce-style', value);
4819
4819
  }
4820
4820
 
4821
+ function nodeIndex(node, normalized) {
4822
+ var idx = 0, lastNodeType, nodeType;
4823
+
4824
+ if (node) {
4825
+ for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {
4826
+ nodeType = node.nodeType;
4827
+
4828
+ // Normalize text nodes
4829
+ if (normalized && nodeType == 3) {
4830
+ if (nodeType == lastNodeType || !node.nodeValue.length) {
4831
+ continue;
4832
+ }
4833
+ }
4834
+ idx++;
4835
+ lastNodeType = nodeType;
4836
+ }
4837
+ }
4838
+
4839
+ return idx;
4840
+ }
4841
+
4821
4842
  /**
4822
4843
  * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class.
4823
4844
  *
@@ -6234,26 +6255,7 @@ define("tinymce/dom/DOMUtils", [
6234
6255
  * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization.
6235
6256
  * @return {Number} Index of the specified node.
6236
6257
  */
6237
- nodeIndex: function(node, normalized) {
6238
- var idx = 0, lastNodeType, nodeType;
6239
-
6240
- if (node) {
6241
- for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {
6242
- nodeType = node.nodeType;
6243
-
6244
- // Normalize text nodes
6245
- if (normalized && nodeType == 3) {
6246
- if (nodeType == lastNodeType || !node.nodeValue.length) {
6247
- continue;
6248
- }
6249
- }
6250
- idx++;
6251
- lastNodeType = nodeType;
6252
- }
6253
- }
6254
-
6255
- return idx;
6256
- },
6258
+ nodeIndex: nodeIndex,
6257
6259
 
6258
6260
  /**
6259
6261
  * Splits an element into two new elements and places the specified split
@@ -6562,6 +6564,7 @@ define("tinymce/dom/DOMUtils", [
6562
6564
  * tinymce.DOM.addClass('someid', 'someclass');
6563
6565
  */
6564
6566
  DOMUtils.DOM = new DOMUtils(document);
6567
+ DOMUtils.nodeIndex = nodeIndex;
6565
6568
 
6566
6569
  return DOMUtils;
6567
6570
  });
@@ -7365,6 +7368,10 @@ define("tinymce/dom/RangeUtils", [
7365
7368
  var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap;
7366
7369
  var directionLeft, isAfterNode;
7367
7370
 
7371
+ function isTableCell(node) {
7372
+ return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
7373
+ }
7374
+
7368
7375
  function hasBrBeforeAfter(node, left) {
7369
7376
  var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body);
7370
7377
 
@@ -7478,7 +7485,7 @@ define("tinymce/dom/RangeUtils", [
7478
7485
  }
7479
7486
 
7480
7487
  // Found a BR/IMG element that we can place the caret before
7481
- if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
7488
+ if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell(node)) {
7482
7489
  offset = dom.nodeIndex(node);
7483
7490
  container = node.parentNode;
7484
7491
 
@@ -10910,27 +10917,29 @@ define("tinymce/html/Serializer", [
10910
10917
  sortedAttrs.map = {};
10911
10918
 
10912
10919
  elementRule = schema.getElementRule(node.name);
10913
- for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
10914
- attrName = elementRule.attributesOrder[i];
10915
-
10916
- if (attrName in attrs.map) {
10917
- attrValue = attrs.map[attrName];
10918
- sortedAttrs.map[attrName] = attrValue;
10919
- sortedAttrs.push({name: attrName, value: attrValue});
10920
+ if (elementRule) {
10921
+ for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
10922
+ attrName = elementRule.attributesOrder[i];
10923
+
10924
+ if (attrName in attrs.map) {
10925
+ attrValue = attrs.map[attrName];
10926
+ sortedAttrs.map[attrName] = attrValue;
10927
+ sortedAttrs.push({name: attrName, value: attrValue});
10928
+ }
10920
10929
  }
10921
- }
10922
10930
 
10923
- for (i = 0, l = attrs.length; i < l; i++) {
10924
- attrName = attrs[i].name;
10931
+ for (i = 0, l = attrs.length; i < l; i++) {
10932
+ attrName = attrs[i].name;
10925
10933
 
10926
- if (!(attrName in sortedAttrs.map)) {
10927
- attrValue = attrs.map[attrName];
10928
- sortedAttrs.map[attrName] = attrValue;
10929
- sortedAttrs.push({name: attrName, value: attrValue});
10934
+ if (!(attrName in sortedAttrs.map)) {
10935
+ attrValue = attrs.map[attrName];
10936
+ sortedAttrs.map[attrName] = attrValue;
10937
+ sortedAttrs.push({name: attrName, value: attrValue});
10938
+ }
10930
10939
  }
10931
- }
10932
10940
 
10933
- attrs = sortedAttrs;
10941
+ attrs = sortedAttrs;
10942
+ }
10934
10943
  }
10935
10944
 
10936
10945
  writer.start(node.name, attrs, isEmpty);
@@ -12045,6 +12054,10 @@ define("tinymce/dom/ControlSelection", [
12045
12054
  return false;
12046
12055
  }
12047
12056
 
12057
+ if (elm == editor.getBody()) {
12058
+ return false;
12059
+ }
12060
+
12048
12061
  return editor.dom.is(elm, selector);
12049
12062
  }
12050
12063
 
@@ -16486,9 +16499,13 @@ define("tinymce/Formatter", [
16486
16499
 
16487
16500
  removeCaretContainer();
16488
16501
 
16489
- // Remove caret container on keydown and it's a backspace, enter or left/right arrow keys
16490
- // Backspace key needs to check if the range is collapsed due to bug #6780
16491
- if ((keyCode == 8 && selection.isCollapsed()) || keyCode == 37 || keyCode == 39) {
16502
+ // Remove caret container if it's empty
16503
+ if (keyCode == 8 && selection.isCollapsed() && selection.getStart().innerHTML == INVISIBLE_CHAR) {
16504
+ removeCaretContainer(getParentCaretContainer(selection.getStart()));
16505
+ }
16506
+
16507
+ // Remove caret container on keydown and it's left/right arrow keys
16508
+ if (keyCode == 37 || keyCode == 39) {
16492
16509
  removeCaretContainer(getParentCaretContainer(selection.getStart()));
16493
16510
  }
16494
16511
 
@@ -17002,6 +17019,10 @@ define("tinymce/EnterKey", [
17002
17019
  dom.getContentEditable(node) !== "true";
17003
17020
  }
17004
17021
 
17022
+ function isTableCell(node) {
17023
+ return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
17024
+ }
17025
+
17005
17026
  // Renders empty block on IE
17006
17027
  function renderBlockOnIE(block) {
17007
17028
  var oldRng;
@@ -17268,10 +17289,15 @@ define("tinymce/EnterKey", [
17268
17289
 
17269
17290
  // Not in a block element or in a table cell or caption
17270
17291
  parentBlock = dom.getParent(container, dom.isBlock);
17271
- rootBlockName = editor.getBody().nodeName.toLowerCase();
17272
17292
  if (!parentBlock || !canSplitBlock(parentBlock)) {
17273
17293
  parentBlock = parentBlock || editableRoot;
17274
17294
 
17295
+ if (parentBlock == editor.getBody() || isTableCell(parentBlock)) {
17296
+ rootBlockName = parentBlock.nodeName.toLowerCase();
17297
+ } else {
17298
+ rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();
17299
+ }
17300
+
17275
17301
  if (!parentBlock.hasChildNodes()) {
17276
17302
  newBlock = dom.create(blockName);
17277
17303
  setForcedBlockAttrs(newBlock);
@@ -17342,6 +17368,10 @@ define("tinymce/EnterKey", [
17342
17368
  return containerBlock;
17343
17369
  }
17344
17370
 
17371
+ if (containerBlock == editor.getBody()) {
17372
+ return;
17373
+ }
17374
+
17345
17375
  // Check if we are in an nested list
17346
17376
  var containerBlockParentName = containerBlock.parentNode.nodeName;
17347
17377
  if (/^(OL|UL|LI)$/.test(containerBlockParentName)) {
@@ -18305,7 +18335,9 @@ define("tinymce/EditorCommands", [
18305
18335
 
18306
18336
  // Setup parser and serializer
18307
18337
  parser = editor.parser;
18308
- serializer = new Serializer({}, editor.schema);
18338
+ serializer = new Serializer({
18339
+ validate: settings.validate
18340
+ }, editor.schema);
18309
18341
  bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;&#x200B;</span>';
18310
18342
 
18311
18343
  // Run beforeSetContent handlers on the HTML to be inserted
@@ -25621,6 +25653,59 @@ define("tinymce/WindowManager", [
25621
25653
  };
25622
25654
  });
25623
25655
 
25656
+ // Included from: js/tinymce/classes/dom/NodePath.js
25657
+
25658
+ /**
25659
+ * NodePath.js
25660
+ *
25661
+ * Released under LGPL License.
25662
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
25663
+ *
25664
+ * License: http://www.tinymce.com/license
25665
+ * Contributing: http://www.tinymce.com/contributing
25666
+ */
25667
+
25668
+ /**
25669
+ * Handles paths of nodes within an element.
25670
+ *
25671
+ * @private
25672
+ * @class tinymce.dom.NodePath
25673
+ */
25674
+ define("tinymce/dom/NodePath", [
25675
+ "tinymce/dom/DOMUtils"
25676
+ ], function(DOMUtils) {
25677
+ function create(rootNode, targetNode, normalized) {
25678
+ var path = [];
25679
+
25680
+ for (; targetNode && targetNode != rootNode; targetNode = targetNode.parentNode) {
25681
+ path.push(DOMUtils.nodeIndex(targetNode, normalized));
25682
+ }
25683
+
25684
+ return path;
25685
+ }
25686
+
25687
+ function resolve(rootNode, path) {
25688
+ var i, node, children;
25689
+
25690
+ for (node = rootNode, i = path.length - 1; i >= 0; i--) {
25691
+ children = node.childNodes;
25692
+
25693
+ if (path[i] > children.length - 1) {
25694
+ return null;
25695
+ }
25696
+
25697
+ node = children[path[i]];
25698
+ }
25699
+
25700
+ return node;
25701
+ }
25702
+
25703
+ return {
25704
+ create: create,
25705
+ resolve: resolve
25706
+ };
25707
+ });
25708
+
25624
25709
  // Included from: js/tinymce/classes/util/Quirks.js
25625
25710
 
25626
25711
  /**
@@ -25645,11 +25730,12 @@ define("tinymce/util/Quirks", [
25645
25730
  "tinymce/util/VK",
25646
25731
  "tinymce/dom/RangeUtils",
25647
25732
  "tinymce/dom/TreeWalker",
25733
+ "tinymce/dom/NodePath",
25648
25734
  "tinymce/html/Node",
25649
25735
  "tinymce/html/Entities",
25650
25736
  "tinymce/Env",
25651
25737
  "tinymce/util/Tools"
25652
- ], function(VK, RangeUtils, TreeWalker, Node, Entities, Env, Tools) {
25738
+ ], function(VK, RangeUtils, TreeWalker, NodePath, Node, Entities, Env, Tools) {
25653
25739
  return function(editor) {
25654
25740
  var each = Tools.each, $ = editor.$;
25655
25741
  var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
@@ -26028,6 +26114,111 @@ define("tinymce/util/Quirks", [
26028
26114
  }
26029
26115
  }
26030
26116
 
26117
+ /**
26118
+ * This retains the formatting if the last character is to be deleted.
26119
+ *
26120
+ * Backspace on this: <p><b><i>a|</i></b></p> would become <p>|</p> in WebKit.
26121
+ * With this patch: <p><b><i>|<br></i></b></p>
26122
+ */
26123
+ function handleLastBlockCharacterDelete(isForward, rng) {
26124
+ var path, blockElm, newBlockElm, clonedBlockElm, sibling,
26125
+ container, offset, br, currentFormatNodes;
26126
+
26127
+ function cloneTextBlockWithFormats(blockElm, node) {
26128
+ currentFormatNodes = $(node).parents().filter(function(idx, node) {
26129
+ return !!editor.schema.getTextInlineElements()[node.nodeName];
26130
+ });
26131
+
26132
+ newBlockElm = blockElm.cloneNode(false);
26133
+
26134
+ currentFormatNodes = Tools.map(currentFormatNodes, function(formatNode) {
26135
+ formatNode = formatNode.cloneNode(false);
26136
+
26137
+ if (newBlockElm.hasChildNodes()) {
26138
+ formatNode.appendChild(newBlockElm.firstChild);
26139
+ newBlockElm.appendChild(formatNode);
26140
+ } else {
26141
+ newBlockElm.appendChild(formatNode);
26142
+ }
26143
+
26144
+ newBlockElm.appendChild(formatNode);
26145
+
26146
+ return formatNode;
26147
+ });
26148
+
26149
+ if (currentFormatNodes.length) {
26150
+ br = dom.create('br');
26151
+ currentFormatNodes[0].appendChild(br);
26152
+ dom.replace(newBlockElm, blockElm);
26153
+
26154
+ rng.setStartBefore(br);
26155
+ rng.setEndBefore(br);
26156
+ editor.selection.setRng(rng);
26157
+
26158
+ return br;
26159
+ }
26160
+
26161
+ return null;
26162
+ }
26163
+
26164
+ function isTextBlock(node) {
26165
+ return node && editor.schema.getTextBlockElements()[node.tagName];
26166
+ }
26167
+
26168
+ if (!rng.collapsed) {
26169
+ return;
26170
+ }
26171
+
26172
+ container = rng.startContainer;
26173
+ offset = rng.startOffset;
26174
+ blockElm = dom.getParent(container, dom.isBlock);
26175
+ if (!isTextBlock(blockElm)) {
26176
+ return;
26177
+ }
26178
+
26179
+ if (container.nodeType == 1) {
26180
+ container = container.childNodes[offset];
26181
+ if (container && container.tagName != 'BR') {
26182
+ return;
26183
+ }
26184
+
26185
+ if (isForward) {
26186
+ sibling = blockElm.nextSibling;
26187
+ } else {
26188
+ sibling = blockElm.previousSibling;
26189
+ }
26190
+
26191
+ if (dom.isEmpty(blockElm) && isTextBlock(sibling) && dom.isEmpty(sibling)) {
26192
+ if (cloneTextBlockWithFormats(blockElm, container)) {
26193
+ dom.remove(sibling);
26194
+ return true;
26195
+ }
26196
+ }
26197
+ } else if (container.nodeType == 3) {
26198
+ path = NodePath.create(blockElm, container);
26199
+ clonedBlockElm = blockElm.cloneNode(true);
26200
+ container = NodePath.resolve(clonedBlockElm, path);
26201
+
26202
+ if (isForward) {
26203
+ if (offset >= container.data.length) {
26204
+ return;
26205
+ }
26206
+
26207
+ container.deleteData(offset, 1);
26208
+ } else {
26209
+ if (offset <= 0) {
26210
+ return;
26211
+ }
26212
+
26213
+ container.deleteData(offset - 1, 1);
26214
+ }
26215
+
26216
+ if (dom.isEmpty(clonedBlockElm)) {
26217
+ return cloneTextBlockWithFormats(blockElm, container);
26218
+ }
26219
+ }
26220
+ }
26221
+
26031
26222
  function customDelete(isForward) {
26032
26223
  var mutationObserver, rng, caretElement;
26033
26224
 
@@ -26117,6 +26308,11 @@ define("tinymce/util/Quirks", [
26117
26308
  return;
26118
26309
  }
26119
26310
 
26311
+ if (handleLastBlockCharacterDelete(isForward, rng)) {
26312
+ e.preventDefault();
26313
+ return;
26314
+ }
26315
+
26120
26316
  // Ignore non meta delete in the where there is text before/after the caret
26121
26317
  if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) {
26122
26318
  if (isForward ? offset < container.data.length : offset > 0) {
@@ -26136,7 +26332,7 @@ define("tinymce/util/Quirks", [
26136
26332
 
26137
26333
  // Handle case where text is deleted by typing over
26138
26334
  editor.on('keypress', function(e) {
26139
- if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) {
26335
+ if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode > 31 && !VK.metaKeyPressed(e)) {
26140
26336
  var rng, currentFormatNodes, fragmentNode, blockParent, caretNode, charText;
26141
26337
 
26142
26338
  rng = editor.selection.getRng();
@@ -29355,11 +29551,14 @@ define("tinymce/Editor", [
29355
29551
 
29356
29552
  // Keep scripts from executing
29357
29553
  self.parser.addNodeFilter('script', function(nodes) {
29358
- var i = nodes.length, node;
29554
+ var i = nodes.length, node, type;
29359
29555
 
29360
29556
  while (i--) {
29361
29557
  node = nodes[i];
29362
- node.attr('type', 'mce-' + (node.attr('type') || 'no/type'));
29558
+ type = node.attr('type') || 'no/type';
29559
+ if (type.indexOf('mce-') !== 0) {
29560
+ node.attr('type', 'mce-' + type);
29561
+ }
29363
29562
  }
29364
29563
  });
29365
29564
 
@@ -30162,7 +30361,7 @@ define("tinymce/Editor", [
30162
30361
  * tinymce.activeEditor.setContent('[b]some[/b] html', {format: 'bbcode'});
30163
30362
  */
30164
30363
  setContent: function(content, args) {
30165
- var self = this, body = self.getBody(), forcedRootBlockName;
30364
+ var self = this, body = self.getBody(), forcedRootBlockName, padd;
30166
30365
 
30167
30366
  // Setup args object
30168
30367
  args = args || {};
@@ -30180,14 +30379,24 @@ define("tinymce/Editor", [
30180
30379
  // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
30181
30380
  // It will also be impossible to place the caret in the editor unless there is a BR element present
30182
30381
  if (content.length === 0 || /^\s+$/.test(content)) {
30382
+ padd = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';
30383
+
30384
+ // Todo: There is a lot more root elements that need special padding
30385
+ // so separate this and add all of them at some point.
30386
+ if (body.nodeName == 'TABLE') {
30387
+ content = '<tr><td>' + padd + '</td></tr>';
30388
+ } else if (/^(UL|OL)$/.test(body.nodeName)) {
30389
+ content = '<li>' + padd + '</li>';
30390
+ }
30391
+
30183
30392
  forcedRootBlockName = self.settings.forced_root_block;
30184
30393
 
30185
30394
  // Check if forcedRootBlock is configured and that the block is a valid child of the body
30186
30395
  if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
30187
30396
  // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly
30188
- content = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';
30397
+ content = padd;
30189
30398
  content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content);
30190
- } else if (!ie) {
30399
+ } else if (!ie && !content) {
30191
30400
  // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret
30192
30401
  content = '<br data-mce-bogus="1">';
30193
30402
  }
@@ -30198,7 +30407,9 @@ define("tinymce/Editor", [
30198
30407
  } else {
30199
30408
  // Parse and serialize the html
30200
30409
  if (args.format !== 'raw') {
30201
- content = new Serializer({}, self.schema).serialize(
30410
+ content = new Serializer({
30411
+ validate: self.validate
30412
+ }, self.schema).serialize(
30202
30413
  self.parser.parse(content, {isRootContent: true})
30203
30414
  );
30204
30415
  }
@@ -31130,7 +31341,7 @@ define("tinymce/EditorManager", [
31130
31341
  * @property minorVersion
31131
31342
  * @type String
31132
31343
  */
31133
- minorVersion: '2.6',
31344
+ minorVersion: '2.7',
31134
31345
 
31135
31346
  /**
31136
31347
  * Release date of TinyMCE build.
@@ -31138,7 +31349,7 @@ define("tinymce/EditorManager", [
31138
31349
  * @property releaseDate
31139
31350
  * @type String
31140
31351
  */
31141
- releaseDate: '2015-09-28',
31352
+ releaseDate: '2015-10-27',
31142
31353
 
31143
31354
  /**
31144
31355
  * Collection of editor instances.
@@ -35542,6 +35753,23 @@ define("tinymce/ui/FormatControls", [
35542
35753
 
35543
35754
  formatMenu = createFormatMenu();
35544
35755
 
35756
+ function initOnPostRender() {
35757
+ var self = this;
35758
+
35759
+ // TODO: Fix this
35760
+ if (editor.formatter) {
35761
+ editor.formatter.formatChanged(name, function(state) {
35762
+ self.active(state);
35763
+ });
35764
+ } else {
35765
+ editor.on('init', function() {
35766
+ editor.formatter.formatChanged(name, function(state) {
35767
+ self.active(state);
35768
+ });
35769
+ });
35770
+ }
35771
+ }
35772
+
35545
35773
  // Simple format controls <control/format>:<UI text>
35546
35774
  each({
35547
35775
  bold: 'Bold',
@@ -35554,20 +35782,7 @@ define("tinymce/ui/FormatControls", [
35554
35782
  editor.addButton(name, {
35555
35783
  tooltip: text,
35556
35784
  onPostRender: function() {
35557
- var self = this;
35558
-
35559
- // TODO: Fix this
35560
- if (editor.formatter) {
35561
- editor.formatter.formatChanged(name, function(state) {
35562
- self.active(state);
35563
- });
35564
- } else {
35565
- editor.on('init', function() {
35566
- editor.formatter.formatChanged(name, function(state) {
35567
- self.active(state);
35568
- });
35569
- });
35570
- }
35785
+ initOnPostRender();
35571
35786
  },
35572
35787
  onclick: function() {
35573
35788
  toggleFormat(name);
@@ -35611,20 +35826,7 @@ define("tinymce/ui/FormatControls", [
35611
35826
  tooltip: item[0],
35612
35827
  cmd: item[1],
35613
35828
  onPostRender: function() {
35614
- var self = this;
35615
-
35616
- // TODO: Fix this
35617
- if (editor.formatter) {
35618
- editor.formatter.formatChanged(name, function(state) {
35619
- self.active(state);
35620
- });
35621
- } else {
35622
- editor.on('init', function() {
35623
- editor.formatter.formatChanged(name, function(state) {
35624
- self.active(state);
35625
- });
35626
- });
35627
- }
35829
+ initOnPostRender();
35628
35830
  }
35629
35831
  });
35630
35832
  });