bootstrap-wysihtml5-rails 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ task 'update' do
7
7
  system("git clone git://github.com/jhollingworth/bootstrap-wysihtml5.git")
8
8
  system("cp bootstrap-wysihtml5/src/bootstrap-wysihtml5.css vendor/assets/stylesheets/bootstrap-wysihtml5.css")
9
9
  system("cp bootstrap-wysihtml5/src/bootstrap-wysihtml5.js vendor/assets/javascripts/bootstrap-wysihtml5.js")
10
- system("cp bootstrap-wysihtml5/lib/js/wysihtml5-0.3.0_rc2.js vendor/assets/javascripts/wysihtml5.js")
10
+ system("cp bootstrap-wysihtml5/lib/js/wysihtml5-0.3.0_rc3.js vendor/assets/javascripts/wysihtml5.js")
11
11
  system("git status")
12
12
  end
13
13
 
@@ -1,5 +1,5 @@
1
1
  module BootstrapWysihtml5Rails
2
2
  module Rails
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@
16
16
  "<div class='btn-group'>"
17
17
  + "<a class='btn' data-wysihtml5-command='bold' title='CTRL+B'>Bold</a>"
18
18
  + "<a class='btn' data-wysihtml5-command='italic' title='CTRL+I'>Italic</a>"
19
- //,+ "<a class='btn' data-wysihtml5-command='underline' title='CTRL+U'>Underline</a>"
19
+ + "<a class='btn' data-wysihtml5-command='underline' title='CTRL+U'>Underline</a>"
20
20
  + "</div>"
21
21
  + "</li>",
22
22
  "lists": "<li>"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license wysihtml5 v0.3.0_rc2
2
+ * @license wysihtml5 v0.3.0_rc3
3
3
  * https://github.com/xing/wysihtml5
4
4
  *
5
5
  * Author: Christopher Blum (https://github.com/tiff)
@@ -9,7 +9,7 @@
9
9
  *
10
10
  */
11
11
  var wysihtml5 = {
12
- version: "0.3.0_rc2",
12
+ version: "0.3.0_rc3",
13
13
 
14
14
  // namespaces
15
15
  commands: {},
@@ -5315,7 +5315,7 @@ wysihtml5.dom.replaceWithChildNodes = function(node) {
5315
5315
  "XMLHttpRequest", "XDomainRequest"
5316
5316
  ],
5317
5317
  /**
5318
- * Properties to unset/proetect on the document object
5318
+ * Properties to unset/protect on the document object
5319
5319
  */
5320
5320
  documentProperties = [
5321
5321
  "referrer",
@@ -6761,12 +6761,14 @@ wysihtml5.Commands = Base.extend(
6761
6761
  */
6762
6762
  exec: function(command, value) {
6763
6763
  var obj = wysihtml5.commands[command],
6764
+ args = wysihtml5.lang.array(arguments).get(),
6764
6765
  method = obj && obj.exec;
6765
6766
 
6766
6767
  this.editor.fire("beforecommand:composer");
6767
6768
 
6768
6769
  if (method) {
6769
- return method.call(obj, this.composer, command, value);
6770
+ args.unshift(this.composer);
6771
+ return method.apply(obj, args);
6770
6772
  } else {
6771
6773
  try {
6772
6774
  // try/catch for buggy firefox
@@ -6789,9 +6791,11 @@ wysihtml5.Commands = Base.extend(
6789
6791
  */
6790
6792
  state: function(command, commandValue) {
6791
6793
  var obj = wysihtml5.commands[command],
6794
+ args = wysihtml5.lang.array(arguments).get(),
6792
6795
  method = obj && obj.state;
6793
6796
  if (method) {
6794
- return method.call(obj, this.composer, command, commandValue);
6797
+ args.unshift(this.composer);
6798
+ return method.apply(obj, args);
6795
6799
  } else {
6796
6800
  try {
6797
6801
  // try/catch for buggy firefox
@@ -6905,7 +6909,7 @@ wysihtml5.Commands = Base.extend(
6905
6909
  hasElementChild = !!anchor.querySelector("*");
6906
6910
  isEmpty = textContent === "" || textContent === wysihtml5.INVISIBLE_SPACE;
6907
6911
  if (!hasElementChild && isEmpty) {
6908
- dom.setTextContent(anchor, anchor.href);
6912
+ dom.setTextContent(anchor, attributes.text || anchor.href);
6909
6913
  whiteSpace = doc.createTextNode(" ");
6910
6914
  composer.selection.setAfter(anchor);
6911
6915
  composer.selection.insertNode(whiteSpace);
@@ -6958,7 +6962,7 @@ wysihtml5.Commands = Base.extend(
6958
6962
  */
6959
6963
  (function(wysihtml5) {
6960
6964
  var undef,
6961
- REG_EXP = /wysiwyg-font-size-[a-z]+/g;
6965
+ REG_EXP = /wysiwyg-font-size-[a-z\-]+/g;
6962
6966
 
6963
6967
  wysihtml5.commands.fontSize = {
6964
6968
  exec: function(composer, command, size) {
@@ -7660,17 +7664,14 @@ wysihtml5.Commands = Base.extend(
7660
7664
  }
7661
7665
  };
7662
7666
  })(wysihtml5);(function(wysihtml5) {
7663
- var undef,
7664
- REG_EXP = /wysiwyg-text-decoration-underline/g,
7665
- CLASS_NAME = "wysiwyg-text-decoration-underline";
7666
-
7667
+ var undef;
7667
7668
  wysihtml5.commands.underline = {
7668
7669
  exec: function(composer, command) {
7669
- return wysihtml5.commands.formatInline.exec(composer, command, "span", CLASS_NAME, REG_EXP);
7670
+ return wysihtml5.commands.formatInline.exec(composer, command, "u");
7670
7671
  },
7671
7672
 
7672
7673
  state: function(composer, command) {
7673
- return wysihtml5.commands.formatInline.state(composer, command, "span", CLASS_NAME, REG_EXP);
7674
+ return wysihtml5.commands.formatInline.state(composer, command, "u");
7674
7675
  },
7675
7676
 
7676
7677
  value: function() {
@@ -8371,15 +8372,23 @@ wysihtml5.views.View = Base.extend(
8371
8372
  // When copying styles, we only get the computed style which is never returned in percent unit
8372
8373
  // Therefore we've to recalculate style onresize
8373
8374
  if (!wysihtml5.browser.hasCurrentStyleProperty()) {
8374
- dom.observe(win, "resize", function() {
8375
- var originalDisplayStyle = dom.getStyle("display").from(textareaElement);
8375
+ var winObserver = dom.observe(win, "resize", function() {
8376
+ // Remove event listener if composer doesn't exist anymore
8377
+ if (!dom.contains(document.documentElement, that.iframe)) {
8378
+ winObserver.stop();
8379
+ return;
8380
+ }
8381
+ var originalTextareaDisplayStyle = dom.getStyle("display").from(textareaElement),
8382
+ originalComposerDisplayStyle = dom.getStyle("display").from(that.iframe);
8376
8383
  textareaElement.style.display = "";
8384
+ that.iframe.style.display = "none";
8377
8385
  dom.copyStyles(RESIZE_STYLE)
8378
8386
  .from(textareaElement)
8379
8387
  .to(that.iframe)
8380
8388
  .andTo(that.focusStylesHost)
8381
8389
  .andTo(that.blurStylesHost);
8382
- textareaElement.style.display = originalDisplayStyle;
8390
+ that.iframe.style.display = originalComposerDisplayStyle;
8391
+ textareaElement.style.display = originalTextareaDisplayStyle;
8383
8392
  });
8384
8393
  }
8385
8394
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-wysihtml5-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-09 00:00:00.000000000 Z
12
+ date: 2012-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: -4085197196618276745
97
+ hash: -3117343480703653692
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: -4085197196618276745
106
+ hash: -3117343480703653692
107
107
  requirements: []
108
108
  rubyforge_project:
109
109
  rubygems_version: 1.8.21