wysihtml-rails 0.6.0.beta → 0.6.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,7 @@
11
11
  //= require ./extra_commands/foreColor.js
12
12
  //= require ./extra_commands/foreColorStyle.js
13
13
  //= require ./extra_commands/insertBlockQuote.js
14
+ //= require ./extra_commands/insertHorizontalRule.js
14
15
  //= require ./extra_commands/insertOrderedList.js
15
16
  //= require ./extra_commands/insertUnorderedList.js
16
17
  //= require ./extra_commands/italic.js
@@ -0,0 +1,27 @@
1
+ wysihtml.commands.insertHorizontalRule = (function() {
2
+ return {
3
+ exec: function(composer) {
4
+ var node = composer.selection.getSelectedNode(),
5
+ phrasingOnlyParent = wysihtml.dom.getParentElement(node, { query: wysihtml.PERMITTED_PHRASING_CONTENT_ONLY }, null, composer.editableArea),
6
+ elem = document.createElement('hr'),
7
+ range, idx;
8
+
9
+ // HR is not allowed into some elements (where only phrasing content is allowed)
10
+ // thus the HR insertion must break out of those https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories
11
+ if (phrasingOnlyParent) {
12
+ composer.selection.splitElementAtCaret(phrasingOnlyParent, elem);
13
+ } else {
14
+ composer.selection.insertNode(elem);
15
+ }
16
+
17
+ if (elem.nextSibling) {
18
+ composer.selection.setBefore(elem.nextSibling);
19
+ } else {
20
+ composer.selection.setAfter(elem);
21
+ }
22
+ },
23
+ state: function() {
24
+ return false; // :(
25
+ }
26
+ };
27
+ })();
@@ -1020,7 +1020,7 @@ wysihtml.commands.mergeTableCells = {
1020
1020
  }.bind(this),
1021
1021
  iframeInitiator = (function() {
1022
1022
  hideHandlers.call(this);
1023
- actions.removeListeners(this.sandbox.getIframe(), ['focus', 'mouseup', 'mouseover'], iframeInitiator);
1023
+ this.actions.removeListeners(this.sandbox.getIframe(), ['focus', 'mouseup', 'mouseover'], iframeInitiator);
1024
1024
  }).bind(this);
1025
1025
 
1026
1026
  if (
@@ -1029,14 +1029,14 @@ wysihtml.commands.mergeTableCells = {
1029
1029
  wysihtml.browser.supportsCommand(this.doc, 'enableInlineTableEditing')
1030
1030
  ) {
1031
1031
  if (this.sandbox.getIframe) {
1032
- actions.addListeners(this.sandbox.getIframe(), ['focus', 'mouseup', 'mouseover'], iframeInitiator);
1032
+ this.actions.addListeners(this.sandbox.getIframe(), ['focus', 'mouseup', 'mouseover'], iframeInitiator);
1033
1033
  } else {
1034
1034
  this.win.addEventListener('load', hideHandlers);
1035
1035
  }
1036
1036
  }
1037
1037
  this.tableSelection = wysihtml.quirks.tableCellsSelection(this.element, this.parent);
1038
1038
  };
1039
-
1039
+
1040
1040
  // Cell selections handling
1041
1041
  var tableCellsSelection = function(editable, editor) {
1042
1042
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wysihtml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta
4
+ version: 0.6.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanel Jakobsoo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -81,6 +81,7 @@ files:
81
81
  - vendor/assets/javascripts/wysihtml/extra_commands/foreColor.js
82
82
  - vendor/assets/javascripts/wysihtml/extra_commands/foreColorStyle.js
83
83
  - vendor/assets/javascripts/wysihtml/extra_commands/insertBlockQuote.js
84
+ - vendor/assets/javascripts/wysihtml/extra_commands/insertHorizontalRule.js
84
85
  - vendor/assets/javascripts/wysihtml/extra_commands/insertOrderedList.js
85
86
  - vendor/assets/javascripts/wysihtml/extra_commands/insertUnorderedList.js
86
87
  - vendor/assets/javascripts/wysihtml/extra_commands/italic.js