Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new version of Aloha 0.23.2

  • Loading branch information...
commit 9cc240477377935c73cebcf23cffb90e2d0d0143 1 parent 59023a7
@did did authored
Showing with 24,580 additions and 203,104 deletions.
  1. +21 −20 Gemfile.lock
  2. +15 −6 Rakefile
  3. +1 −0  app/assets/javascripts/aloha.js
  4. +1 −1  lib/aloha/rails/engine.rb
  5. +2 −2 lib/aloha/rails/version.rb
  6. +3 −3 locomotive-aloha-rails.gemspec
  7. +24 −0 vendor/assets/javascripts/aloha/css/aloha-common-extra.css
  8. +4 −29 vendor/assets/javascripts/aloha/css/aloha-core.css
  9. +24 −0 vendor/assets/javascripts/aloha/css/aloha-reset.css
  10. +77 −89 vendor/assets/javascripts/aloha/css/aloha-sidebar.css
  11. +31 −7,777 vendor/assets/javascripts/aloha/css/aloha.css
  12. +0 −33 vendor/assets/javascripts/aloha/css/ext-aloha-reset.css
  13. +0 −360 vendor/assets/javascripts/aloha/css/ext-aloha.css
  14. BIN  vendor/assets/javascripts/aloha/img/arrow-down.png
  15. BIN  vendor/assets/javascripts/aloha/img/arrow-left.png
  16. BIN  vendor/assets/javascripts/aloha/img/arrow.png
  17. BIN  vendor/assets/javascripts/aloha/img/base-big.png
  18. BIN  vendor/assets/javascripts/aloha/img/base-multi.png
  19. BIN  vendor/assets/javascripts/aloha/img/base.png
  20. BIN  vendor/assets/javascripts/aloha/img/bg.png
  21. BIN  vendor/assets/javascripts/aloha/img/breadcrumb-divider.png
  22. BIN  vendor/assets/javascripts/aloha/img/gentics-logo.png
  23. 0  vendor/assets/javascripts/aloha/img/grabhandle.png
  24. 0  vendor/assets/javascripts/aloha/img/maximize.png
  25. 0  vendor/assets/javascripts/aloha/img/multisplit-base.jpg
  26. BIN  vendor/assets/javascripts/aloha/img/multisplit-close.gif
  27. BIN  vendor/assets/javascripts/aloha/img/multisplit-open.gif
  28. BIN  vendor/assets/javascripts/aloha/img/pin.png
  29. BIN  vendor/assets/javascripts/aloha/img/removeformat.png
  30. BIN  vendor/assets/javascripts/aloha/img/text_indent.png
  31. BIN  vendor/assets/javascripts/aloha/img/text_indent_remove.png
  32. +0 −28,276 vendor/assets/javascripts/aloha/lib/aloha-bootstrap.js
  33. +12 −0 vendor/assets/javascripts/aloha/lib/aloha-jquery-noconflict.js
  34. +532 −89,342 vendor/assets/javascripts/aloha/lib/aloha.js
  35. +153 −0 vendor/assets/javascripts/aloha/lib/aloha/block-jump.js
  36. +161 −123 vendor/assets/javascripts/aloha/lib/aloha/command.js
  37. +312 −295 vendor/assets/javascripts/aloha/lib/aloha/console.js
  38. +82 −44 vendor/assets/javascripts/aloha/lib/aloha/contenthandlermanager.js
  39. +108 −0 vendor/assets/javascripts/aloha/lib/aloha/copypaste.js
  40. +453 −410 vendor/assets/javascripts/aloha/lib/aloha/core.js
  41. +0 −194 vendor/assets/javascripts/aloha/lib/aloha/ecma5.js
  42. +307 −277 vendor/assets/javascripts/aloha/lib/aloha/ecma5shims.js
  43. +548 −408 vendor/assets/javascripts/aloha/lib/aloha/editable.js
  44. +7,359 −7,182 vendor/assets/javascripts/aloha/lib/aloha/engine.js
  45. +485 −0 vendor/assets/javascripts/aloha/lib/aloha/ephemera.js
  46. +0 −86 vendor/assets/javascripts/aloha/lib/aloha/ext-alohaproxy.js
  47. +0 −50 vendor/assets/javascripts/aloha/lib/aloha/ext-alohareader.js
  48. +0 −77 vendor/assets/javascripts/aloha/lib/aloha/ext-alohatreeloader.js
  49. +0 −32 vendor/assets/javascripts/aloha/lib/aloha/ext.js
  50. +0 −1,496 vendor/assets/javascripts/aloha/lib/aloha/floatingmenu.js
  51. +28 −545 vendor/assets/javascripts/aloha/lib/aloha/ierange-m2.js
  52. +364 −146 vendor/assets/javascripts/aloha/lib/aloha/jquery.aloha.js
  53. +0 −34 vendor/assets/javascripts/aloha/lib/aloha/jquery.js
  54. +0 −115 vendor/assets/javascripts/aloha/lib/aloha/jquery.patch.js
  55. +1,272 −1,255 vendor/assets/javascripts/aloha/lib/aloha/markup.js
  56. +0 −115 vendor/assets/javascripts/aloha/lib/aloha/message.js
  57. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/ca/i18n.js
  58. +11 −10 vendor/assets/javascripts/aloha/lib/aloha/nls/de/i18n.js
  59. +19 −19 vendor/assets/javascripts/aloha/lib/aloha/nls/i18n.js
  60. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/mk/i18n.js
  61. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/pt-br/i18n.js
  62. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/ru/i18n.js
  63. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/uk/i18n.js
  64. +11 −0 vendor/assets/javascripts/aloha/lib/aloha/nls/zh-hans/i18n.js
  65. +43 −36 vendor/assets/javascripts/aloha/lib/aloha/observable.js
  66. +80 −75 vendor/assets/javascripts/aloha/lib/aloha/plugin.js
  67. +146 −97 vendor/assets/javascripts/aloha/lib/aloha/pluginmanager.js
  68. +30 −3,242 vendor/assets/javascripts/aloha/lib/aloha/rangy-core.js
  69. +102 −24 vendor/assets/javascripts/aloha/lib/aloha/registry.js
  70. +137 −123 vendor/assets/javascripts/aloha/lib/aloha/repository.js
  71. +742 −571 vendor/assets/javascripts/aloha/lib/aloha/repositorymanager.js
  72. +77 −61 vendor/assets/javascripts/aloha/lib/aloha/repositoryobjects.js
  73. +2,402 −2,102 vendor/assets/javascripts/aloha/lib/aloha/selection.js
  74. +566 −664 vendor/assets/javascripts/aloha/lib/aloha/sidebar.js
  75. +125 −0 vendor/assets/javascripts/aloha/lib/aloha/state-override.js
  76. +0 −530 vendor/assets/javascripts/aloha/lib/aloha/ui-attributefield.js
  77. +0 −214 vendor/assets/javascripts/aloha/lib/aloha/ui-browser.js
  78. +0 −889 vendor/assets/javascripts/aloha/lib/aloha/ui.js
  79. +329 −187 vendor/assets/javascripts/aloha/lib/css.js
  80. +118 −79 vendor/assets/javascripts/aloha/lib/i18n.js
  81. +0 −49 vendor/assets/javascripts/aloha/lib/jquery-plugin.js
  82. +0 −140 vendor/assets/javascripts/aloha/lib/order.js
  83. +1,424 −1,384 vendor/assets/javascripts/aloha/lib/require.js
  84. +39 −13 vendor/assets/javascripts/aloha/lib/text.js
  85. +240 −0 vendor/assets/javascripts/aloha/lib/util/arrays.js
  86. +32 −0 vendor/assets/javascripts/aloha/lib/util/browser.js
  87. +67 −69 vendor/assets/javascripts/aloha/lib/util/class.js
  88. +1,525 −1,504 vendor/assets/javascripts/aloha/lib/util/dom.js
  89. +748 −0 vendor/assets/javascripts/aloha/lib/util/dom2.js
  90. +62 −0 vendor/assets/javascripts/aloha/lib/util/functions.js
  91. +121 −0 vendor/assets/javascripts/aloha/lib/util/html.js
  92. +240 −257 vendor/assets/javascripts/aloha/lib/util/json2.js
  93. +65 −0 vendor/assets/javascripts/aloha/lib/util/keys.js
  94. +89 −66 vendor/assets/javascripts/aloha/lib/util/lang.js
  95. +108 −0 vendor/assets/javascripts/aloha/lib/util/maps.js
  96. +51 −0 vendor/assets/javascripts/aloha/lib/util/misc.js
  97. +176 −158 vendor/assets/javascripts/aloha/lib/util/position.js
  98. +528 −0 vendor/assets/javascripts/aloha/lib/util/range-context.js
  99. +799 −805 vendor/assets/javascripts/aloha/lib/util/range.js
  100. +114 −0 vendor/assets/javascripts/aloha/lib/util/strings.js
  101. +336 −0 vendor/assets/javascripts/aloha/lib/util/trees.js
  102. +70 −0 vendor/assets/javascripts/aloha/lib/vendor/3rdparty.txt
  103. +298 −0 vendor/assets/javascripts/aloha/lib/vendor/amplify.store.js
  104. +76 −0 vendor/assets/javascripts/aloha/lib/vendor/class.js
  105. +0 −2,470 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/adapter/jquery/ext-jquery-adapter-debug.js
  106. +0 −7 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/adapter/jquery/ext-jquery-adapter.js
  107. +0 −47,708 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/ext-all-debug.js
  108. +0 −13 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/ext-all.js
  109. +0 −674 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/gpl-3.0.txt
  110. +0 −42 vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/license.txt
  111. BIN  vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/resources/charts.swf
Sorry, we could not display the entire diff because too many files (1,294) changed.
View
41 Gemfile.lock
@@ -1,45 +1,46 @@
PATH
remote: .
specs:
- locomotive-aloha-rails (0.20.1.3)
- actionpack (~> 3.2.1)
+ locomotive-aloha-rails (0.23.2.1)
+ actionpack (~> 3.2.13)
GEM
remote: http://rubygems.org/
specs:
- actionpack (3.2.3)
- activemodel (= 3.2.3)
- activesupport (= 3.2.3)
+ actionpack (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- journey (~> 1.0.1)
- rack (~> 1.4.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.1.2)
- activemodel (3.2.3)
- activesupport (= 3.2.3)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
- activesupport (3.2.3)
- i18n (~> 0.6)
+ activesupport (3.2.13)
+ i18n (= 0.6.1)
multi_json (~> 1.0)
- builder (3.0.0)
+ builder (3.0.4)
erubis (2.7.0)
hike (1.2.1)
- i18n (0.6.0)
- journey (1.0.3)
- multi_json (1.3.2)
- rack (1.4.1)
+ i18n (0.6.1)
+ journey (1.0.4)
+ multi_json (1.7.1)
+ rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
- rack-test (0.6.1)
+ rack-test (0.6.2)
rack (>= 1.0)
rake (0.9.2)
- sprockets (2.1.2)
+ sprockets (2.2.2)
hike (~> 1.2)
+ multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- tilt (1.3.3)
+ tilt (1.3.6)
PLATFORMS
ruby
View
21 Rakefile
@@ -31,16 +31,21 @@ desc "Update Aloha Editor to version specified in lib/aloha/rails/version.rb"
task :update => [ :fetch, :extract, :process ]
task :fetch do
- download("https://github.com/downloads/alohaeditor/Aloha-Editor/alohaeditor-#{Aloha::VERSION}.zip", "alohaeditor.zip")
+ download("https://github.com/alohaeditor/Aloha-Editor/archive/alohaeditor-#{Aloha::VERSION}.zip", "alohaeditor.zip")
end
task :extract do
step "Extracting core files" do
`rm -rf tmp/aloha`
`unzip -u tmp/alohaeditor.zip -d tmp`
+ `mv tmp/Aloha-Editor-alohaeditor-#{Aloha::VERSION}/src tmp/aloha`
+ `rm -rf tmp/Aloha-Editor-alohaeditor-#{Aloha::VERSION}`
- %w(build.txt package.json plugins/extra/browser/css/browsercombined.css.backup).each { |file| `rm tmp/aloha/#{file}` }
- %w(demo test plugins/extra/speak plugins/extra/flag-icons plugins/extra/googletranslate plugins/extra/wai-lang plugins/extra/zemanta).each { |folder| `rm -rf tmp/aloha/#{folder}` }
+ %w(package.json).each { |file| `rm tmp/aloha/#{file}` }
+ %w(demo test plugins/extra/speak plugins/extra/flag-icons plugins/extra/googletranslate plugins/extra/wai-lang plugins/extra/zemanta plugins/extra/proxy).each { |folder| `rm -rf tmp/aloha/#{folder}` }
+ %w(1.5.1 1.6.1 1.6 1.7.1).each { |version| `rm tmp/aloha/lib/vendor/jquery-#{version}.js` }
+ Dir['tmp/aloha/**/demo'].each { |file| `rm -rf #{file}` if File.directory?(file) }
+ Dir['tmp/aloha/**/test'].each { |file| `rm -rf #{file}` if File.directory?(file) }
`rm -rf vendor/assets/javascripts/aloha`
`mkdir -p vendor/assets/javascripts/aloha`
@@ -50,11 +55,15 @@ end
task :process do
step "Fixing file encoding" do
- require 'iconv'
- converter = Iconv.new('UTF-8', 'ISO-8859-1')
Dir["vendor/assets/javascripts/aloha/**/*.js"].each do |file|
- contents = converter.iconv(File.read(file)).force_encoding('UTF-8')
+ contents = File.read(file).encode('UTF-8', 'ISO-8859-1')
File.open(file, 'w') { |f| f.write(contents) }
end
end
+ step "Wrong color in the aloha.css file" do
+ file = 'vendor/assets/javascripts/aloha/css/aloha.css'
+ content = File.read(file)
+ content.gsub!('#NaNbbaaNaN00NaN00NaN00NaN00NaN', '#000')
+ File.open(file, 'w') { |f| f.write(content) }
+ end
end
View
1  app/assets/javascripts/aloha.js
@@ -1,2 +1,3 @@
//= require aloha/preinit.js
+//= require aloha/lib/require.js
//= require aloha/lib/aloha.js
View
2  lib/aloha/rails/engine.rb
@@ -2,7 +2,7 @@ module Aloha
module Rails
class Engine < ::Rails::Engine
initializer 'precompile', :group => :all do |app|
- app.config.assets.precompile << 'aloha.js'
+ app.config.assets.precompile += ['aloha.js', 'aloha/css/aloha.css']
end
end
end
View
4 lib/aloha/rails/version.rb
@@ -1,7 +1,7 @@
module Aloha
- VERSION = '0.20.10'
+ VERSION = '0.23.2'
module Rails
- VERSION = '0.20.1.5'
+ VERSION = '0.23.2.1'
end
end
View
6 locomotive-aloha-rails.gemspec
@@ -5,14 +5,14 @@ require 'aloha/rails/version'
Gem::Specification.new do |s|
s.name = 'locomotive-aloha-rails'
s.version = Aloha::Rails::VERSION
- s.summary = 'Rails 3.1 integration for Aloha Editor.'
- s.description = 'Seamlessly integrates Aloha Editor into the Rails 3.1 asset pipeline.'
+ s.summary = 'Rails 3.2 integration for Aloha Editor.'
+ s.description = 'Seamlessly integrates Aloha Editor into the Rails 3.2 asset pipeline.'
s.homepage = 'https://github.com/locomotivecms/aloha-rails'
s.files = Dir['README.md', 'LICENSE', 'Rakefile', 'app/**/*', 'lib/**/*', 'vendor/**/*']
s.authors = ['Didier Lafforgue']
s.email = 'didier.lafforgue@gmail.com'
- s.add_dependency 'actionpack', '~> 3.2.1'
+ s.add_dependency 'actionpack', '~> 3.2.13'
s.add_development_dependency 'rake', '0.9.2'
end
View
24 vendor/assets/javascripts/aloha/css/aloha-common-extra.css
@@ -0,0 +1,24 @@
+/* This file should only contain import statements, only one each for
+ * the core and plugins, so that it is easy to make variations of this
+ * file that exclude some plugins.
+ */
+@import "aloha-core.css";
+@import "../plugins/common/abbr/css/abbr.css";
+@import "../plugins/common/ui/css/ui.css";
+@import "../plugins/common/link/css/link.css";
+@import "../plugins/common/characterpicker/css/characterpicker.css";
+@import "../plugins/common/highlighteditables/css/highlighteditables.css";
+@import "../plugins/common/horizontalruler/css/horizontalruler.css";
+@import "../plugins/common/block/css/block.css";
+@import "../plugins/common/align/css/align.css";
+@import "../plugins/common/image/css/image.css";
+@import "../plugins/common/table/css/table.css";
+@import "../plugins/extra/cite/css/cite.css";
+@import "../plugins/extra/formatlesspaste/css/formatless.css";
+@import "../plugins/extra/wai-lang/css/wai-lang.css";
+@import "../plugins/extra/numerated-headers/css/numerated-headers.css";
+@import "../plugins/extra/ribbon/css/ribbon.css";
+@import "../plugins/extra/headerids/css/headerids.css";
+@import "../plugins/extra/metaview/css/metaview.css";
+@import "../plugins/extra/textcolor/css/textcolor.css";
+
View
33 vendor/assets/javascripts/aloha/css/aloha-core.css
@@ -1,3 +1,7 @@
+@import "aloha-reset.css";
+@import "aloha-sidebar.css";
+@import "../lib/vendor/repository-browser/css/repository-browser.css";
+
.aloha-editable {
min-height: 1.2em;
outline: none;
@@ -7,35 +11,6 @@
background: #80B5F2;
color: white;
}
-.aloha-editable-zerowidthfix {
- padding: 0px 5px 0px 5px !important;
-}
-
-
-
-.aloha-logo {
- width:37px !important;
- height:25px !important;
- background-image: url('../img/gentics-logo.png') !important;
-}
-.aloha-maximize {
- background-image: url('../img/gentics-logo.png') !important;
-}
-.aloha-fade-out {
- background-image: url('../img/fade-out.png') !important;
- width:20px !important;
- height:20px !important;
-}
-.aloha-fade-in {
- background-image: url('../img/fade-in.png') !important;
- width:20px !important;
- height:20px !important;
-}
-.aloha-maximize {
- width:20px !important;
- height:20px !important;
- background-image: url('../img/maximize.png') !important;
-}
.aloha-textarea {
overflow: hidden;
border:1px solid #ccc;
View
24 vendor/assets/javascripts/aloha/css/aloha-reset.css
@@ -0,0 +1,24 @@
+/**
+ * Aloha CSS reset.
+ * Original by Eric Meyer. Modified for use in Aloha.
+ * Every element used in the Aloha Editor UI should have a an appropriate reset here.
+ */
+
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+.aloha div, .aloha span, .aloha button, .aloha a, .aloha img,
+.aloha ol, .aloha ul, .aloha li, .aloha label {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+.aloha ol, .aloha ul {
+ list-style: none;
+}
View
166 vendor/assets/javascripts/aloha/css/aloha-sidebar.css
@@ -7,10 +7,9 @@
font-family: Arial, sans-serif;
font-size: 12px;
border-right: 1px solid #888;
- -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
- -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
- box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
-
+ -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
+ -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
}
.aloha-sidebar-bar.aloha-sidebar-right {
left: auto;
@@ -42,17 +41,17 @@
padding: 0 15px;
}
.aloha-sidebar-panel-top {
- -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
- -moz-border-radius-topleft: 5px;
- -moz-border-radius-topright: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-topright: 5px;
}
.aloha-sidebar-panel-content.aloha-sidebar-panel-bottom {
padding-bottom: 0;
- -webkit-border-bottom-left-radius: 5px;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-bottomleft: 5px;
- -moz-border-radius-bottomright: 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -moz-border-radius-bottomright: 5px;
border-bottom-width: 1px;
}
.aloha-sidebar-panel-title {
@@ -63,26 +62,25 @@
border-bottom-width: 0;
background-color: #303539;
background-image: -webkit-gradient(
- linear,
- center top,
- center bottom,
- color-stop(0.00, #6c6f74),
- color-stop(0.05, #4c4f54),
- color-stop(0.10, #3f4448),
- color-stop(0.45, #383d41),
- color-stop(0.50, #303539),
- color-stop(0.95, #33363b)
+ linear,
+ center top,
+ center bottom,
+ color-stop(0.00, #6c6f74),
+ color-stop(0.05, #4c4f54),
+ color-stop(0.10, #3f4448),
+ color-stop(0.45, #383d41),
+ color-stop(0.50, #303539),
+ color-stop(0.95, #33363b)
);
background-image: -moz-linear-gradient(
- center top,
+ center top,
#6c6f74 0%,
#4c4f54 5%,
#3f4448 10%,
- #383d41 45%,
- #303539 50%,
- #33363b 95%
+ #383d41 45%,
+ #303539 50%,
+ #33363b 95%
);
-
color: #ccc;
cursor: pointer;
font-size: 13px;
@@ -101,11 +99,9 @@
height: 16px;
background: url(../img/arrow.png) no-repeat center center;
opacity: 0.3;
-
}
.aloha-sidebar-panel-title:hover .aloha-sidebar-panel-title-arrow {
opacity: 0.9;
-
}
.aloha-sidebar-panel-title .aloha-sidebar-panel-title-arrow.aloha-sidebar-panel-title-arrow-down {
background-image: url(../img/arrow-down.png);
@@ -146,58 +142,55 @@
width: 40px;
height: 30px;
overflow: hidden;
-
background-color: #303539;
background-image: -webkit-gradient(
- linear,
- center top,
- center bottom,
- color-stop(0.00, #6c6f74),
- color-stop(0.05, #4c4f54),
- color-stop(0.10, #3f4448),
- color-stop(0.45, #383d41),
- color-stop(0.50, #303539),
- color-stop(0.95, #33363b)
+ linear,
+ center top,
+ center bottom,
+ color-stop(0.00, #6c6f74),
+ color-stop(0.05, #4c4f54),
+ color-stop(0.10, #3f4448),
+ color-stop(0.45, #383d41),
+ color-stop(0.50, #303539),
+ color-stop(0.95, #33363b)
);
background-image: -moz-linear-gradient(
- center top,
+ center top,
#6c6f74 0%,
#4c4f54 5%,
#3f4448 10%,
- #383d41 45%,
- #303539 50%,
- #33363b 95%
+ #383d41 45%,
+ #303539 50%,
+ #33363b 95%
);
-
-
cursor: pointer;
-
- -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
- -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
- box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
-
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
- -moz-border-radius-topright: 5px;
- -moz-border-radius-bottomright: 5px;
- -webkit-border-top-right-radius: 5px;
+
+ -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
+ -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, .5);
+
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
+ -moz-border-radius-topright: 5px;
+ -moz-border-radius-bottomright: 5px;
+ -webkit-border-top-right-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
.aloha-sidebar-right .aloha-sidebar-handle {
left: -30px;
- border-top-right-radius: 0px;
- border-bottom-right-radius: 0px;
- -moz-border-radius-topright: 0px;
- -moz-border-radius-bottomright: 0px;
- -webkit-border-top-right-radius: 0px;
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+ -moz-border-radius-topright: 0px;
+ -moz-border-radius-bottomright: 0px;
+ -webkit-border-top-right-radius: 0px;
-webkit-border-bottom-right-radius: 0px;
-
- border-top-left-radius: 5px;
- border-bottom-left-radius: 5px;
- -moz-border-radius-topleft: 5px;
- -moz-border-radius-bottomleft: 5px;
- -webkit-border-top-left-radius: 5px;
- -webkit-border-bottom-left-radius: 5px;
+
+ border-top-left-radius: 5px;
+ border-bottom-left-radius: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
}
.aloha-sidebar-handle-icon {
display: block;
@@ -208,7 +201,6 @@
width: 20px;
height: 20px;
opacity: 0.5;
-
}
.aloha-sidebar-right .aloha-sidebar-handle-icon {
left: 5px;
@@ -220,26 +212,25 @@
.aloha-sidebar-panel-parent-path {
background-color: #303539;
background-image: -webkit-gradient(
- linear,
- center top,
- center bottom,
- color-stop(0.00, #6c6f74),
- color-stop(0.05, #4c4f54),
- color-stop(0.10, #3f4448),
- color-stop(0.45, #383d41),
- color-stop(0.50, #303539),
- color-stop(0.95, #33363b)
+ linear,
+ center top,
+ center bottom,
+ color-stop(0.00, #6c6f74),
+ color-stop(0.05, #4c4f54),
+ color-stop(0.10, #3f4448),
+ color-stop(0.45, #383d41),
+ color-stop(0.50, #303539),
+ color-stop(0.95, #33363b)
);
background-image: -moz-linear-gradient(
- center top,
+ center top,
#6c6f74 0%,
#4c4f54 5%,
#3f4448 10%,
- #383d41 45%,
- #303539 50%,
- #33363b 95%
+ #383d41 45%,
+ #303539 50%,
+ #33363b 95%
);
-
color: #fff;
cursor: pointer;
font-size: 12px;
@@ -249,20 +240,17 @@
}
.aloha-sidebar-panel-parent-path:hover {
opacity: 0.9;
-
}
.aloha-sidebar-panel-parent-path span {
display: inline-block;
padding: 0 10px 0 5px;
background: url(../img/breadcrumb-divider.png) no-repeat right center;
opacity: 0.25;
-
line-height: 1.6em;
}
.aloha-sidebar-panel-parent-path span:first-child {
font-weight: bold;
opacity: 0.8;
-
}
.aloha-sidebar-panel-parent-path span:last-child {
background: none;
@@ -270,14 +258,14 @@
.aloha-sidebar-panel-parent-content {
padding: 4px;
background-image: -webkit-gradient(
- linear,
- center top,
- center bottom,
- color-stop(0.0, rgba(0, 0, 0, 0.25)),
- color-stop(0.05, rgba(0, 0, 0, 0.0))
+ linear,
+ center top,
+ center bottom,
+ color-stop(0.0, rgba(0, 0, 0, 0.25)),
+ color-stop(0.05, rgba(0, 0, 0, 0.0))
);
background-image: -moz-linear-gradient(
- center top,
+ center top,
rgba(0, 0, 0, 0.25) 0%,
rgba(0, 0, 0, 0.0) 5%
);
View
7,808 vendor/assets/javascripts/aloha/css/aloha.css
31 additions, 7,777 deletions not shown
View
33 vendor/assets/javascripts/aloha/css/ext-aloha-reset.css
@@ -1,33 +0,0 @@
-.aloha-floatingmenu table, .aloha-floatingmenu tr, .aloha-floatingmenu td,
-.ext-root table, .ext-root tr, .ext-root td,
-table.x-layer, .x-layer tr, .x-layer td,
-table.x-window, .x-window tr, .x-window td,
-table.x-toolbar-ct, .x-toolbar-ct tr, .x-toolbar-ct td,
-table.x-toolbar-left, .x-toolbar-left tr, .x-toolbar-left td,
-table.x-table-layout, .x-table-layout tr, .x-table-layout td,
-table.x-toolbar-ct table, .x-toolbar-cell td, .x-table-layout-cell td {
- width: 0 !important;
- height: 0 !important;
- border: 0 !important;
- padding: 0 !important;
- margin: 0 !important;
- background-color: transparent !important;
-}
-/* reset for floatingmenu */
-div.aloha-floatingmenu, div.aloha-shadow {
- min-width: 0px;
-}
-/* more specific for browsers that support nth-child. */
-.ext-root tr:nth-child(2n), .ext-root tr:nth-child(3n), .ext-root tr:nth-child(4n), .ext-root tr:nth-child(5n) {
- width: 0 !important;
- height: 0 !important;
- border: 0 !important;
- padding: 0 !important;
- margin: 0 !important;
- background-color: transparent !important;
-}
-.ext-root ol, .ext-root ul, .x-menu ul, .x-menu ol {
- list-style:none;
- margin:0;
- padding:0;
-}
View
360 vendor/assets/javascripts/aloha/css/ext-aloha.css
@@ -1,360 +0,0 @@
-.aloha-floatingmenu {
- position: absolute;
-}
-.aloha-floatingmenu.fixed {
- position: fixed !important;
-}
-.aloha-floatingmenu .x-tab-panel-header {
- border-width: 0px 0px 1px 0px !important;
- background: none !important;
-}
-.aloha-floatingmenu .x-tab-panel-header .x-tab-strip-wrap, .aloha-floatingmenu ul.x-tab-strip-top {
- background: none !important;
-}
-.x-tab-strip-wrap ul li a:hover {
- border: none;
- text-decoration:none;
-}
-.aloha-floatingmenu .x-tab-panel-header {
- padding-bottom: 0px !important;
-}
-.aloha-floatingmenu:hover {
- background-color: #E0E0E0;
- -moz-border-radius-topleft: 3px;
- -moz-border-radius-topright: 3px;
- -webkit-border-top-left-radius: 3px;
- -webkit-border-top-right-radius: 3px;
- border-top-left-radius: 3px;
- border-top-right-radius: 3px;
- background: url(../img/grabhandle.png) no-repeat scroll center 5px rgba(0, 0, 0, 0.4);
-}
-.aloha-floatingmenu:hover .aloha-floatingmenu-pin {
- display: block;
-}
-.aloha-floatingmenu-pin {
- background: url("../img/pin.png") no-repeat scroll 0 6px transparent;
- cursor: pointer;
- margin-left: 5px !important;
- width: 16px;
- position: absolute !important;
- right: 10px;
- display: none;
-}
-.aloha-floatingmenu-pinned {
- background-position: -16px 6px;
-}
-#aloha-floatingmenu-shadow {
- position: absolute;
- top: -1000;
- left: -1000;
- display: none;
- z-index: 8800;
-}
-#aloha-floatingmenu-shadow.fixed {
- position: fixed !important;
-}
-
-.x-tree-root-ct {
- padding: 0px;
-}
-.x-tree-node {
- list-style: none;
-}
-.x-tree-node-ct {
- padding: 0px;
-}
-.aloha-button a:focus {
- outline: none;
-}
-button.aloha-button {
- background: url('../img/base.png') no-repeat !important;
-}
-button.aloha-button-big {
- background: url('../img/base-big.png') no-repeat !important;
-}
-button.aloha-button-b {
- background-position: 0px 0px;
-}
-button.aloha-button-i {
- background-position: -16px 0px !important;
-}
-button.aloha-button-u {
- background-position: -32px 0px !important;
-}
-button.aloha-button-del {
- background-position: -48px 0px !important;
-}
-button.aloha-button-s {
- background-position: -48px 0px !important;
-}
-button.aloha-button-sub {
- background-position: -64px 0px !important;
-}
-button.aloha-button-sup {
- background-position: -80px 0px !important;
-}
-button.aloha-button-ul {
- background-position: -256px 0px !important;
-}
-button.aloha-button-ol {
- background-position: -272px 0px !important;
-}
-button.aloha-button-indent-list {
- background-image: url(../img/text_indent.png) !important;
-}
-button.aloha-button-outdent-list {
- background-image: url(../img/text_indent_remove.png) !important;
-}
-button.aloha-button-a {
- background-position: -288px 0px !important;
-}
-button.aloha-button-a-remove {
- background-position: -304px 0px !important;
-}
-button.aloha-button-p {
- background-position: 0px 0 !important;
-}
-button.aloha-button-p-de {
- background-position: 0px -42px !important;
-}
-button.aloha-button-h1 {
- background-position: -52px 0 !important;
-}
-button.aloha-button-h1-de {
- background-position: -52px -42px !important;
-}
-button.aloha-button-h2 {
- background-position: -104px 0 !important;
-}
-button.aloha-button-h2-de {
- background-position: -104px -42px !important;
-}
-button.aloha-button-h3 {
- background-position: -156px 0 !important;
-}
-button.aloha-button-h3-de {
- background-position: -156px -42px !important;
-}
-button.aloha-button-h4 {
- background-position: -208px 0 !important;
-}
-button.aloha-button-h4-de {
- background-position: -208px -42px !important;
-}
-button.aloha-button-h5 {
- background-position: -260px 0 !important;
-}
-button.aloha-button-h5-de {
- background-position: -260px -42px !important;
-}
-button.aloha-button-h6 {
- background-position: -312px 0 !important;
-}
-button.aloha-button-h6-de {
- background-position: -312px -42px !important;
-}
-button.aloha-button-pre {
- background-position: -364px 0 !important;
-}
-button.aloha-button-pre-de {
- background-position: -364px -42px !important;
-}
-button.aloha-button-title {
- background-position: -416px 0 !important;
-}
-button.aloha-button-title-de {
- background-position: -416px -42px !important;
-}
-button.aloha-button-table {
- background-position: -96px 0 !important;
-}
-button.aloha-button-addColumnLeft {
- background-position: -112px 0 !important;
-}
-button.aloha-button-addColumnRight {
- background-position: -128px 0 !important;
-}
-button.aloha-button-addRowBefore {
- background-position: -144px 0 !important;
-}
-button.aloha-button-addRowAfter {
- background-position: -160px 0 !important;
-}
-button.aloha-button-deleteRows {
- background-position: -176px 0 !important;
-}
-button.aloha-button-deleteColumns {
- background-position: -192px 0 !important;
-}
-button.aloha-button-addPerson {
- background-position: -224px 0 !important;
-}
-button.aloha-button-addEvent {
- background-position: -208px 0 !important;
-}
-button.aloha-button-abbr {
- background-position: -336px 0px !important;
-}
-button.aloha-button-row-header {
- background-position: -352px 0px !important;
-}
-button.aloha-button-col-header {
- background-position: -368px 0px !important;
-}
-button.aloha-button-tree {
- background-position: -0 0 !important;
-}
-div.aloha-button a:hover {
- border: 1px solid #b2cbff;
-}
-.aloha-floatingmenu {
- display: none;
-}
-.aloha-floatingmenu .pressed a {
- border:1px solid #ccc;
-}
-
-html body #aloha-ribbon {
- z-index:90000;
- position:fixed;
- top:0;
- left:0;
- width:100%;
- padding-left:0;
- padding-right:0;
- display: none;
-}
-.x-menu-list-item {
- text-align:left;
-}
-.aloha-shadow {
- -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
- -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
- box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
-}
-ul.aloha-multisplit button.aloha-button {
- background-image: url(../img/base-multi.png) !important;
- background-repeat: no-repeat;
- background-position: 0 0;
-
- width: 54px !important;
- height: 44px !important;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-}
-.aloha-multisplit {
- float: left;
- list-style: none;
-}
-ul.aloha-multisplit, div.aloha-multisplit-wrapper {
- width: 232px;
- height: 46px;
- overflow: hidden;
- margin: 0px;
- padding: 0px;
-}
-div.aloha-multisplit-wrapper {
- width: 248px;
-}
-ul.aloha-multisplit li {
- float: left;
- padding: 0px 1px;
- margin: 0px;
-}
-ul.aloha-multisplit button.aloha-multisplit-wide {
- font: 11px tahoma,arial,helvetica;
- height: 18px !important;
- width: 234px !important;
- border: 0;
- border-top: 1px solid #cccccc;
- cursor: pointer;
- background-color: white;
- background-repeat: no-repeat;
- background-position: 6px 1px !important;
- text-align: left;
- margin-left: -2px;
- padding-left: 26px;
-}
-button.aloha-multisplit-toggle {
- float: right;
- margin: 0;
- padding: 0;
- width: 15px;
- height: 12px;
- margin-top: 32px;
- cursor: pointer;
- border: 0;
-}
-button.aloha-multisplit-toggle-open {
- background-image: url(../img/multisplit-open.gif);
-}
-button.aloha-multisplit-toggle-close {
- background-image: url(../img/multisplit-close.gif);
-}
-ul.aloha-multisplit button {
- border: 1px solid #cccccc;
- margin: 1px;
- cursor: pointer;
-}
-ul.aloha-multisplit button:hover {
- border: 1px solid #666666;
-}
-ul.aloha-multisplit button.aloha-multisplit-wide:hover {
- border: 0;
- border-top: 1px solid #cccccc;
-}
-ul.aloha-multisplit .aloha-multisplit-activeitem button {
- border: 2px solid #3B73D7;
-}
-ul.aloha-multisplit-expanded {
- position: absolute;
- top: 0px;
- left: 0px;
- z-index: 20000;
- background-color: white;
- border: 1px solid #afafaf;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
-}
-ul.aloha-multisplit button.aloha-button-removeFormat {
- background-image: url(../img/removeformat.png) !important;
-}
-
-/**
- * combo-list box
- */
-.x-combo-list {
- text-align: left;
-}
-.x-combo-list-inner {
- padding: 3px;
-}
-.x-combo-list-inner .loading-indicator {
- margin: 0;
-}
-.x-combo-selected {
- color: #fff !important;
- background-color: #3B73D7 !important;
-}
-
-/**
- * ui-attribute field
- */
-.x-form-field.x-form-text {
- color: #333 !important;
- padding: 3px;
-}
-.x-form-field.x-form-text::selection {
- color: #fff;
- background: #3B73D7;
-}
-.x-form-field.x-form-text::-moz-selection {
- color: #fff;
- background: #3B73D7;
-}
-.x-form-field.x-form-text::-webkit-selection {
- color: #fff;
- background: #3B73D7;
-}
View
BIN  vendor/assets/javascripts/aloha/img/arrow-down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/arrow-left.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/base-big.png
Deleted file not rendered
View
BIN  vendor/assets/javascripts/aloha/img/base-multi.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/base.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/bg.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/breadcrumb-divider.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/javascripts/aloha/img/fade-in.png
Deleted file not rendered
View
0  vendor/assets/javascripts/aloha/img/fade-out.png
Deleted file not rendered
View
BIN  vendor/assets/javascripts/aloha/img/gentics-logo.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/javascripts/aloha/img/grabhandle.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/javascripts/aloha/img/maximize.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  vendor/assets/javascripts/aloha/img/multisplit-base.jpg 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/multisplit-close.gif 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/multisplit-open.gif 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/pin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/removeformat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/text_indent.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  vendor/assets/javascripts/aloha/img/text_indent_remove.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
28,276 vendor/assets/javascripts/aloha/lib/aloha-bootstrap.js
0 additions, 28,276 deletions not shown
View
12 vendor/assets/javascripts/aloha/lib/aloha-jquery-noconflict.js
@@ -0,0 +1,12 @@
+// To be included in the compiled aloha-full.js (which includes
+// requirejs and jQuery) immediately after jQuery. This will prevent
+// Aloha's jQuery from polluting the global namespace.
+// TODO: requirejs shouldn't leak either
+// NB: this is only for aloha-full.js to preserve behaviour with the way
+// older builds of aloha were done. It is now always preferred to use
+// aloha-bare.js (which doesn't include either requirejs or jQuery) and
+// let the implementer worry exactly how to set up jQuery and requirejs
+// to suit his needs.
+Aloha = window.Aloha || {};
+Aloha.settings = Aloha.settings || {};
+Aloha.settings.jQuery = Aloha.settings.jQuery || jQuery.noConflict(true);
View
89,874 vendor/assets/javascripts/aloha/lib/aloha.js
532 additions, 89,342 deletions not shown
View
153 vendor/assets/javascripts/aloha/lib/aloha/block-jump.js
@@ -0,0 +1,153 @@
+/* block-jump.js is part of the Aloha Editor project http://aloha-editor.org
+ *
+ * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
+ * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
+ * Contributors http://aloha-editor.org/contribution.php
+ *
+ * Aloha Editor is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * Aloha Editor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As an additional permission to the GNU GPL version 2, you may distribute
+ * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
+ * source code without the copy of the GNU GPL normally required,
+ * provided you include this license notice and a URL through which
+ * recipients can access the Corresponding Source.
+ */
+/**
+ * Implements some logic related to moving the cursor keys across blocks.
+ *
+ * In the following example
+ *
+ * "some text<span class="aloha-block ..." contenteditable="false" ...>...</span>[]some text"
+ *
+ * when one moves the cursor indicated by "[]" to the left, the entire
+ * non-contenteditable block is skipped. The same for moving the cursor
+ * right across the block.
+ *
+ * TODO: actually, the block shouldn't be skipped, it should be
+ * selected/highlighted first.
+ * TODO: this file currently doesn't contain all the code to implement
+ * block jumping. Some of it is currently implemented in markup.js.
+ */
+define([
+ 'aloha/core',
+ 'jquery',
+ 'aloha/console'
+], function (
+ Aloha,
+ $,
+ console
+) {
+ 'use strict';
+
+ var zeroWidthNode = null;
+
+ /**
+ * Replaces the text in given text with the given text.
+ *
+ * @param node
+ * A text node attached to the DOM.
+ * @param text
+ * A string that is to replace the text of the given text node.
+ */
+ function replaceMergeTextNode(node, text) {
+ node.deleteData(0, node.length);
+ if ('' !== text) {
+ if (node.nextSibling && 3 === node.nextSibling.nodeType) {
+ node.nextSibling.insertData(0, text);
+ } else if (node.previousSibling && 3 === node.previousSibling.nodeType) {
+ node.previousSibling.insertData(node.previousSibling.length, text);
+ } else {
+ node.insertData(0, text);
+ }
+ }
+ // We don't remove the node immediately to avoid intefering with a
+ // caller's range object that may have a start or end containers
+ // equal to this node. Removing it in a timeout may still interfere
+ // with the selection, but that was not a problem during testing.
+ setTimeout(function () {
+ if (0 === node.length) {
+ $(node).remove();
+ }
+ }, 0);
+ }
+
+ /**
+ * Removes a previously inserted zero width text node.
+ * See insertZeroWidthTextNodeFix().
+ */
+ function removeZeroWidthTextNodeFix() {
+ if (!zeroWidthNode) {
+ return;
+ }
+ // We want to only replace a single zero-width character to avoid
+ // interfering with the other zero-width whitespace hack that makes
+ // empty lines visible in IE7.
+ var text = zeroWidthNode.nodeValue.replace(/\u200b/, '');
+ if (text === zeroWidthNode.nodeValue) {
+ console.warn('Expected to remove the zero width text node fix, but couldn\'t find it');
+ }
+ replaceMergeTextNode(zeroWidthNode, text);
+ zeroWidthNode = null;
+ }
+
+ /**
+ * Inserts a zero width text node before or after a block.
+ *
+ * There is a problem where some browsers can't select the boundary
+ * between some contenteditable content and non-contenteditable
+ * content. For example, if in the example at the top of the file
+ * the selection were one step to the right "...</span>s[]ome..."
+ * and the left cursor key were pressed, then the selection would
+ * just disappear or be stuck between the span and the text node.
+ *
+ * To work around this problem a zero width text node is inserted
+ * before or after a block.
+ *
+ * The inserted zero width text node will be removed automatically
+ * when it isn't necessary any more (on selection change or on
+ * editable.getContents()).
+ *
+ * TODO: In retrospect, a better alternative may be to simply wrap
+ * every inlin-block with an editable span.
+ * @param block
+ * The DOM element for a block before or after which the zero
+ * width text node will be inserted.
+ * @param isGoingLeft
+ * True if the zero width text node is to be inserted after
+ * the block element, or false if the zero width text node is
+ * to be inserted before the block element.
+ * @return
+ * The text node that was inserted.
+ */
+ function insertZeroWidthTextNodeFix(block, isGoingLeft) {
+ removeZeroWidthTextNodeFix();
+ zeroWidthNode = document.createTextNode("\u200b");
+ if (isGoingLeft) {
+ $(block).after(zeroWidthNode);
+ } else {
+ $(block).before(zeroWidthNode);
+ }
+ Aloha.bind('aloha-selection-changed', function (event) {
+ removeZeroWidthTextNodeFix();
+ Aloha.unbind(event);
+ });
+ return zeroWidthNode;
+ }
+
+ return {
+ removeZeroWidthTextNodeFix: removeZeroWidthTextNodeFix,
+ insertZeroWidthTextNodeFix: insertZeroWidthTextNodeFix
+ };
+});
View
284 vendor/assets/javascripts/aloha/lib/aloha/command.js
@@ -1,200 +1,238 @@
-/*!
-* CommandManager file is part of Aloha Editor Project http://aloha-editor.org
-* Copyright (c) 2010-2011 Gentics Software GmbH, aloha@gentics.com
-* Contributors http://aloha-editor.org/contribution.php
-* Licensed unter the terms of http://www.aloha-editor.org/license.html
-*//*
-* Aloha Editor is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.*
-*
-* Aloha Editor is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with CommandManager program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-define( [ 'aloha/core', 'aloha/registry', 'aloha/engine', 'util/dom', 'aloha/contenthandlermanager' ],
-function( Aloha, Registry, Engine, Dom, ContentHandlerManager ) {
-
-// Action: What the command does when executed via execCommand(). Every command defined
-// in CommandManager specification has an action defined for it in the relevant section. For example,
-// the bold command's action generally makes the current selection bold, or removes bold if
-// the selection is already bold. An editing toolbar might provide buttons that execute the
-// action for a command if clicked, or a script might run an action without user interaction
-// to achieve some particular effect.
-//
-// Indeterminate: A boolean value returned by queryCommandIndeterm(), depending on the
-// current state of the document. Generally, a command that has a state defined will be
-// indeterminate if the state is true for part but not all of the current selection, and a
-// command that has a value defined will be indeterminate if different parts of the
-// selection have different values. An editing toolbar might display a button or control
-// in a special way if the command is indeterminate, like showing a "bold" button as
-// partially depressed, or leaving a font size selector blank instead of showing the font
-// size of the current selection. As a rule, a command can only be indeterminate if its
-// state is false, supposing it has a state.
-//
-// State: A boolean value returned by queryCommandState(), depending on the current state
-// of the document. The state of a command is true if it is already in effect, in some
-// sense specific to the command. Most commands that have a state defined will take opposite
-// actions depending on whether the state is true or false, such as making the selection
-// bold if the state is false and removing bold if the state is true. Others will just
-// have no effect if the state is true, like the justifyCenter command. Still others will
-// have the same effect regardless, like the styleWithCss command. An editing toolbar might
-// display a button or control differently depending on the state and indeterminacy of the
-// command.
-//
-// Value: A string returned by queryCommandValue(), depending on the current state of the
-// document. A command usually has a value instead of a state if the property it modifies
-// can take more than two different values, like the foreColor command. If the command is
-// indeterminate, its value is generally based on the start of the selection. Otherwise,
-// in most cases the value holds true for the entire selection, but see the justifyCenter
-// command and its three companions for an exception. An editing toolbar might display the
-// value of a command as selected in a drop-down or filled in in a text box, if the command
-// isn't indeterminate.
-//
-// Relevant CSS property: CommandManager is defined for certain inline formatting commands, and
-// is used in algorithms specific to those commands. It is an implementation detail, and
-// is not exposed to authors. If a command does not have a relevant CSS property
-// specified, it defaults to null.
+/* command.js is part of Aloha Editor project http://aloha-editor.org
+ *
+ * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
+ * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
+ * Contributors http://aloha-editor.org/contribution.php
+ *
+ * Aloha Editor is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * Aloha Editor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As an additional permission to the GNU GPL version 2, you may distribute
+ * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
+ * source code without the copy of the GNU GPL normally required,
+ * provided you include this license notice and a URL through which
+ * recipients can access the Corresponding Source.
+ */
+define([
+ 'aloha/core',
+ 'aloha/registry',
+ 'aloha/engine',
+ 'util/dom',
+ 'aloha/contenthandlermanager'
+], function (
+ Aloha,
+ Registry,
+ Engine,
+ Dom,
+ ContentHandlerManager
+) {
+ "use strict";
+
+ // Action: What the command does when executed via execCommand(). Every command defined
+ // in CommandManager specification has an action defined for it in the relevant section. For example,
+ // the bold command's action generally makes the current selection bold, or removes bold if
+ // the selection is already bold. An editing toolbar might provide buttons that execute the
+ // action for a command if clicked, or a script might run an action without user interaction
+ // to achieve some particular effect.
+ //
+ // Indeterminate: A boolean value returned by queryCommandIndeterm(), depending on the
+ // current state of the document. Generally, a command that has a state defined will be
+ // indeterminate if the state is true for part but not all of the current selection, and a
+ // command that has a value defined will be indeterminate if different parts of the
+ // selection have different values. An editing toolbar might display a button or control
+ // in a special way if the command is indeterminate, like showing a "bold" button as
+ // partially depressed, or leaving a font size selector blank instead of showing the font
+ // size of the current selection. As a rule, a command can only be indeterminate if its
+ // state is false, supposing it has a state.
+ //
+ // State: A boolean value returned by queryCommandState(), depending on the current state
+ // of the document. The state of a command is true if it is already in effect, in some
+ // sense specific to the command. Most commands that have a state defined will take opposite
+ // actions depending on whether the state is true or false, such as making the selection
+ // bold if the state is false and removing bold if the state is true. Others will just
+ // have no effect if the state is true, like the justifyCenter command. Still others will
+ // have the same effect regardless, like the styleWithCss command. An editing toolbar might
+ // display a button or control differently depending on the state and indeterminacy of the
+ // command.
+ //
+ // Value: A string returned by queryCommandValue(), depending on the current state of the
+ // document. A command usually has a value instead of a state if the property it modifies
+ // can take more than two different values, like the foreColor command. If the command is
+ // indeterminate, its value is generally based on the start of the selection. Otherwise,
+ // in most cases the value holds true for the entire selection, but see the justifyCenter
+ // command and its three companions for an exception. An editing toolbar might display the
+ // value of a command as selected in a drop-down or filled in in a text box, if the command
+ // isn't indeterminate.
+ //
+ // Relevant CSS property: CommandManager is defined for certain inline formatting commands, and
+ // is used in algorithms specific to those commands. It is an implementation detail, and
+ // is not exposed to authors. If a command does not have a relevant CSS property
+ // specified, it defaults to null.
var CommandManager = {
-
- execCommand: function( commandId, showUi, value, range ) {
-
+
+ execCommand: function (commandId, showUi, value, range) {
+ var evtObj = {
+ commandId: commandId,
+ preventDefault: false
+ };
+ Aloha.trigger('aloha-command-will-execute', evtObj);
+
+ if (evtObj.preventDefault === true) {
+ return;
+ }
// Read current selection if not passed
- if ( !range ) {
- if ( !Aloha.getSelection().getRangeCount() ) {
+ if (!range) {
+ if (!Aloha.getSelection().getRangeCount()) {
return;
}
- range = Aloha.getSelection().getRangeAt( 0 );
+ range = Aloha.getSelection().getRangeAt(0);
}
-
+
// For the insertHTML command we provide contenthandler API
- if ( commandId == 'insertHTML' ) {
+ if (commandId.toLowerCase() === 'inserthtml') {
//if (typeof Aloha.settings.contentHandler.insertHtml === 'undefined') {
// use all registered content handler; used for copy & paste atm (or write log message)
// Aloha.settings.contentHandler.insertHtml = Aloha.defaults.contentHandler.insertHtml;
//}
- value = ContentHandlerManager.handleContent( value, {
- contenthandler: Aloha.settings.contentHandler.insertHtml
+ value = ContentHandlerManager.handleContent(value, {
+ contenthandler: Aloha.settings.contentHandler.insertHtml,
+ command: 'insertHtml'
});
}
- Engine.execCommand( commandId, showUi, value, range );
+ Engine.execCommand(commandId, showUi, value, range);
- if ( Aloha.getSelection().getRangeCount() ) {
+ if (Aloha.getSelection().getRangeCount()) {
// Read range after engine modification
- range = Aloha.getSelection().getRangeAt( 0 );
+ range = Aloha.getSelection().getRangeAt(0);
// FIX: doCleanup should work with W3C range
- var startnode = range.commonAncestorContainer.parentNode;
+ var startnode = range.commonAncestorContainer;
+ if (startnode.parentNode) {
+ startnode = startnode.parentNode;
+ }
var rangeObject = new window.GENTICS.Utils.RangeObject();
rangeObject.startContainer = range.startContainer;
rangeObject.startOffset = range.startOffset;
rangeObject.endContainer = range.endContainer;
rangeObject.endOffset = range.endOffset;
- Dom.doCleanup({merge:true, removeempty: false}, rangeObject, startnode);
+ Dom.doCleanup({
+ merge: true,
+ removeempty: false
+ }, rangeObject, startnode);
rangeObject.select();
}
Aloha.trigger('aloha-command-executed', commandId);
},
-
- // If command is available and not disabled or the active range is not null
+
+ // If command is available and not disabled or the active range is not null
// the command is enabled
- queryCommandEnabled: function( commandId, range ) {
+ queryCommandEnabled: function (commandId, range) {
// Take current selection if not passed
- if ( !range ) {
- if ( !Aloha.getSelection().getRangeCount() ) {
+ if (!range) {
+ if (!Aloha.getSelection().getRangeCount()) {
return;
}
range = Aloha.getSelection().getRangeAt(0);
}
- return Engine.queryCommandEnabled( commandId, range );
+ return Engine.queryCommandEnabled(commandId, range);
},
// "Return true if command is indeterminate, otherwise false."
- queryCommandIndeterm: function( commandId, range ) {
+ queryCommandIndeterm: function (commandId, range) {
// Take current selection if not passed
- if ( !range ) {
- if ( !Aloha.getSelection().getRangeCount() ) {
+ if (!range) {
+ if (!Aloha.getSelection().getRangeCount()) {
return;
}
range = Aloha.getSelection().getRangeAt(0);
}
- return Engine.queryCommandIndeterm( commandId, range );
+ return Engine.queryCommandIndeterm(commandId, range);
},
-
- queryCommandState: function( commandId, range ) {
+
+ queryCommandState: function (commandId, range) {
// Take current selection if not passed
- if ( !range ) {
- if ( !Aloha.getSelection().getRangeCount() ) {
+ if (!range) {
+ if (!Aloha.getSelection().getRangeCount()) {
return;
}
range = Aloha.getSelection().getRangeAt(0);
}
- return Engine.queryCommandState( commandId, range );
+ return Engine.queryCommandState(commandId, range);
},
-
+
// "When the queryCommandSupported(command) method on the HTMLDocument
// interface is invoked, the user agent must return true if command is
// supported, and false otherwise."
- queryCommandSupported: function( commandId ) {
+ queryCommandSupported: function (commandId) {
- return Engine.queryCommandSupported( commandId );
+ return Engine.queryCommandSupported(commandId);
},
-
- queryCommandValue: function( commandId, range ) {
+
+ queryCommandValue: function (commandId, range) {
// Take current selection if not passed
- if ( !range ) {
- if ( !Aloha.getSelection().getRangeCount() ) {
+ if (!range) {
+ if (!Aloha.getSelection().getRangeCount()) {
return;
}
range = Aloha.getSelection().getRangeAt(0);
}
// "Return command's value."
- return Engine.queryCommandValue( commandId, range );
+ return Engine.queryCommandValue(commandId, range);
},
- querySupportedCommands: function() {
+ querySupportedCommands: function () {
- var
- commands = [],
+ var commands = [],
command;
-
- for ( command in Engine.commands ) {
- commands.push( command );
+
+ for (command in Engine.commands) {
+ if (Engine.commands.hasOwnProperty(command)) {
+ commands.push(command);
+ }
}
return commands;
- }
+ },
+ getStateOverride: Engine.getStateOverride,
+ setStateOverride: Engine.setStateOverride,
+ resetOverrides: Engine.resetOverrides,
+ unsetStateOverride: Engine.unsetStateOverride
};
-
+
// create an instance
- CommandManager = new ( Registry.extend( CommandManager ) )();
-
+ CommandManager = new (Registry.extend(CommandManager))();
+
/**
* Executes a registered command.
* http://aryeh.name/spec/editing/editing.html#methods-of-the-htmldocument-interface
* @method
* @param command name of the command
* @param showUI has no effect for Aloha Editor and is only here because in spec...
- * @param value depends on the used command and it impementation
- * @range optional a range on which the command will be executed if not specified
- * the current selection will be used as range
+ * @param value depends on the used command and it impementation
+ * @range optional a range on which the command will be executed if not specified
+ * the current selection will be used as range
*/
Aloha.execCommand = CommandManager.execCommand;
-
+
/**
* Check wheater the command in enabled.
* If command is not supported, raise a NOT_SUPPORTED_ERR exception.
@@ -202,19 +240,19 @@ function( Aloha, Registry, Engine, Dom, ContentHandlerManager ) {
* @return true if command is enabled, false otherwise.
*/
Aloha.queryCommandEnabled = CommandManager.queryCommandEnabled;
-
+
/**
- * Check if the command has an indetermed state.
+ * Check if the command has an indetermed state.
* If command is not supported, a NOT_SUPPORTED_ERR exception is thrown
* If command has no indeterminacy, INVALID_ACCESS_ERR exception is thrown
* If command is not enabled, return false.
* @param command name of the command
- * @range optional a range on which the command will be executed if not specified
- * the current selection will be used as range
+ * @range optional a range on which the command will be executed if not specified
+ * the current selection will be used as range
* @return true if command is indeterminate, otherwise false.
*/
Aloha.queryCommandIndeterm = CommandManager.queryCommandIndeterm;
-
+
/**
* Returns the state of a given command
* If command is not supported, a NOT_SUPPORTED_ERR exception is thrown
@@ -236,14 +274,14 @@ function( Aloha, Registry, Engine, Dom, ContentHandlerManager ) {
* Returns the Value of a given Command
* If command is not supported, a NOT_SUPPORTED_ERR exception is thrown
* If command is not enabled, returns an empty string
- * If command is "fontSize" and its value override is set, an integer
+ * If command is "fontSize" and its value override is set, an integer
* number of pixels is returned as font size for the result.
* If the value override for command is set, it returns that.
* @return command's value.
*/
Aloha.queryCommandValue = CommandManager.queryCommandValue;
-
+
Aloha.querySupportedCommands = CommandManager.querySupportedCommands;
-
+
return CommandManager;
});
View
607 vendor/assets/javascripts/aloha/lib/aloha/console.js 100644 → 100755
@@ -1,330 +1,347 @@
-/*!
-* This file is part of Aloha Editor Project http://aloha-editor.org
-* Copyright © 2010-2011 Gentics Software GmbH, aloha@gentics.com
-* Contributors http://aloha-editor.org/contribution.php
-* Licensed unter the terms of http://www.aloha-editor.org/license.html
-*//*
-* Aloha Editor is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.*
-*
-* Aloha Editor is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-define(
-['aloha/core', 'util/class', 'aloha/jquery'],
-function(Aloha, Class, jQuery ) {
-
-
- var
-// $ = jQuery,
-// Aloha = window.Aloha,
- console = window.console;
-// Class = window.Class
-// GENTICS = window.GENTICS;
-
-/**
- * This is the aloha Log
- * @namespace Aloha
- * @class Log
- * @singleton
+/* console.js is part of Aloha Editor project http://aloha-editor.org
+ *
+ * Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
+ * Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
+ * Contributors http://aloha-editor.org/contribution.php
+ *
+ * Aloha Editor is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * Aloha Editor is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As an additional permission to the GNU GPL version 2, you may distribute
+ * non-source (e.g., minimized or compacted) forms of the Aloha-Editor
+ * source code without the copy of the GNU GPL normally required,
+ * provided you include this license notice and a URL through which
+ * recipients can access the Corresponding Source.
*/
-var alohaConsole = Class.extend({
+define([
+ 'aloha/core',
+ 'util/class',
+ 'jquery'
+], function (
+ Aloha,
+ Class,
+ jQuery
+) {
+ "use strict";
+
/**
- * Initialize the logging
- * @hide
+ * This is the aloha Log
+ * @namespace Aloha
+ * @class Log
+ * @singleton
*/
- init: function() {
-
- // initialize the logging settings (if not present)
- if (typeof Aloha.settings.logLevels === 'undefined' || !Aloha.settings.logLevels) {
- Aloha.settings.logLevels = {'error' : true, 'warn' : true};
- }
+ var AlohaConsole = Class.extend({
+ /**
+ * Initialize the logging
+ * @hide
+ */
+ init: function () {
- // initialize the logHistory settings (if not present)
- if (typeof Aloha.settings.logHistory === 'undefined' || !Aloha.settings.logHistory) {
- Aloha.settings.logHistory = {};
- }
- // set the default values for the loghistory
- if (!Aloha.settings.logHistory.maxEntries) {
- Aloha.settings.logHistory.maxEntries = 100;
- }
- if (!Aloha.settings.logHistory.highWaterMark) {
- Aloha.settings.logHistory.highWaterMark = 90;
- }
- if (!Aloha.settings.logHistory.levels) {
- Aloha.settings.logHistory.levels = {'error' : true, 'warn' : true};
- }
- this.flushLogHistory();
-
- Aloha.trigger('aloha-logger-ready');
- },
+ // initialize the logging settings (if not present)
+ if (typeof Aloha.settings.logLevels === 'undefined' || !Aloha.settings.logLevels) {
+ Aloha.settings.logLevels = {
+ 'error': true,
+ 'warn': true
+ };
+ }
- /**
- * Log History as array of Message Objects. Every object has the properties
- * 'level', 'component' and 'message'
- * @property
- * @type Array
- * @hide
- */
- logHistory: [],
+ // initialize the logHistory settings (if not present)
+ if (typeof Aloha.settings.logHistory === 'undefined' || !Aloha.settings.logHistory) {
+ Aloha.settings.logHistory = {};
+ }
+ // set the default values for the loghistory
+ if (!Aloha.settings.logHistory.maxEntries) {
+ Aloha.settings.logHistory.maxEntries = 100;
+ }
+ if (!Aloha.settings.logHistory.highWaterMark) {
+ Aloha.settings.logHistory.highWaterMark = 90;
+ }
+ if (!Aloha.settings.logHistory.levels) {
+ Aloha.settings.logHistory.levels = {
+ 'error': true,
+ 'warn': true
+ };
+ }
+ this.flushLogHistory();
- /**
- * Flag, which is set as soon as the highWaterMark for the log history is reached.
- * This flag is reset on every call of flushLogHistory()
- * @hide
- */
- highWaterMarkReached: false,
+ Aloha.trigger('aloha-logger-ready');
+ },
- /**
- * Logs a message to the console
- * @method
- * @param {String} level Level of the log ('error', 'warn' or 'info', 'debug')
- * @param {String} component Component that calls the log
- * @param {String} message log message
- */
- log: function(level, component, message) {
-
+ /**
+ * Log History as array of Message Objects. Every object has the properties
+ * 'level', 'component' and 'message'
+ * @property
+ * @type Array
+ * @hide
+ */
+ logHistory: [],
- // log ('Logging message');
- if ( typeof component === 'undefined' ) {
- message = level;
- }
- if ( typeof component !== 'string' && component && component.toString ) {
- component = component.toString();
- }
-
- // log ('warn', 'Warning message');
- if ( typeof message === 'undefined' ) {
- message = component;
- component = undefined;
- }
+ /**
+ * Flag, which is set as soon as the highWaterMark for the log history is reached.
+ * This flag is reset on every call of flushLogHistory()
+ * @hide
+ */
+ highWaterMarkReached: false,
- if (typeof level === 'undefined' || !level) {
- level = 'log';
- }
-
- level = level.toLowerCase();
-
- if ( typeof Aloha.settings.logLevels === "undefined" ) {
- return;
- }
-
- // now check whether the log level is activated
- if ( !Aloha.settings.logLevels[ level ] ) {
- return;
- }
-
- component = component || "Unkown Aloha Component";
-
- this.addToLogHistory({'level' : level, 'component' : component, 'message' : message, 'date' : new Date()});
-
- switch (level) {
- case 'error':
- if (window.console && console.error) {
- // FIXME:
- // Using console.error rather than throwing an error is very
- // problematic because we get not stack.
- // We ought to consider doing the following:
- // throw component + ': ' + message;
- if(!component && !message) {
- console.error("Error occured without message and component");
- } else {
- console.error(component + ': ' + message);
- }
+ /**
+ * Logs a message to the console
+ * @method
+ * @param {String} level Level of the log ('error', 'warn' or 'info', 'debug')
+ * @param {String} component Component that calls the log
+ * @param {String} message log message
+ */
+ log: function (level, component, message) {
+
+
+ // log ('Logging message');
+ if (typeof component === 'undefined') {
+ message = level;
}
- break;
- case 'warn':
- if (window.console && console.warn) {
- console.warn(component + ': ' + message);
+ if (typeof component !== 'string' && component && component.toString) {
+ component = component.toString();
}
- break;
- case 'info':
- if (window.console && console.info) {
- console.info(component + ': ' + message);
+
+ // log ('warn', 'Warning message');
+ if (typeof message === 'undefined') {
+ message = component;
+ component = undefined;
}
- break;
- case 'debug':
- if (window.console && console.log) {
- console.log(component + ' [' + level + ']: ' + message);
+
+ if (typeof level === 'undefined' || !level) {
+ level = 'log';
}
- break;
- default:
- if (window.console && console.log) {
- console.log(component + ' [' + level + ']: ' + message);
+
+ level = level.toLowerCase();
+
+ if (typeof Aloha.settings.logLevels === "undefined") {
+ return;
}
- break;
- }
- },
- /**
- * Log a message of log level 'error'
- * @method
- * @param {String} component Component that calls the log
- * @param {String} message log message
- */
- error: function(component, message) {
- this.log('error', component, message);
- },
+ // now check whether the log level is activated
+ if (!Aloha.settings.logLevels[level]) {
+ return;
+ }
- /**
- * Log a message of log level 'warn'
- * @method
- * @param {String} component Component that calls the log
- * @param {String} message log message
- */
- warn: function(component, message) {
- this.log('warn', component, message);
- },
+ component = component || "Unkown Aloha Component";
- /**
- * Log a message of log level 'info'
- * @method
- * @param {String} component Component that calls the log
- * @param {String} message log message
- */
- info: function(component, message) {
- this.log('info', component, message);
- },
+ this.addToLogHistory({
+ 'level': level,
+ 'component': component,
+ 'message': message,
+ 'date': new Date()
+ });
- /**
- * Log a message of log level 'debug'
- * @param {String} component Component that calls the log
- * @param {String} message log message
- */
- debug: function(component, message) {
- this.log('debug', component, message);
- },
+ var console = window.console;
- /**
- * Methods to mark function as deprecated for developers.
- * @param {String} component String that calls the log
- * @param {String} message log message
- */
- deprecated: function(component, message) {
- this.log( 'warn', component, message );
- // help the developer to locate the call.
- if ( Aloha.settings.logLevels[ 'deprecated' ] ) {
- throw new Error ( message );
- }
- },
-
- /**
- * Check whether the given log level is currently enabled
- * @param {String} level
- * @return true when log level is enabled, false if not
- */
- isLogLevelEnabled: function(level) {
- return Aloha.settings && Aloha.settings.logLevels && Aloha.settings.logLevels[level];
- },
+ switch (level) {
+ case 'error':
+ if (window.console && console.error) {
+ // FIXME:
+ // Using console.error rather than throwing an error is very
+ // problematic because we get not stack.
+ // We ought to consider doing the following:
+ // throw component + ': ' + message;
+ if (!component && !message) {
+ console.error("Error occured without message and component");
+ } else {
+ console.error(component + ': ' + message);
+ }
+ }
+ break;
+ case 'warn':
+ if (window.console && console.warn) {
+ console.warn(component + ': ' + message);
+ }
+ break;
+ case 'info':
+ if (window.console && console.info) {
+ console.info(component + ': ' + message);
+ }
+ break;
+ case 'debug':
+ if (window.console && console.log) {
+ console.log(component + ' [' + level + ']: ' + message);
+ }
+ break;
+ default:
+ if (window.console && console.log) {
+ console.log(component + ' [' + level + ']: ' + message);
+ }
+ break;
+ }
+ },
- /**
- * Check whether error logging is enabled
- * @return true if error logging is enabled, false if not
- */
- isErrorEnabled: function() {
- return this.isLogLevelEnabled('error');
- },
+ /**
+ * Log a message of log level 'error'
+ * @method
+ * @param {String} component Component that calls the log
+ * @param {String} message log message
+ */
+ error: function (component, message) {
+ this.log('error', component, message);
+ },
- /**
- * Check whether warn logging is enabled
- * @return true if warn logging is enabled, false if not
- */
- isWarnEnabled: function() {
- return this.isLogLevelEnabled('warn');
- },
+ /**
+ * Log a message of log level 'warn'
+ * @method
+ * @param {String} component Component that calls the log
+ * @param {String} message log message
+ */
+ warn: function (component, message) {
+ this.log('warn', component, message);
+ },
- /**
- * Check whether info logging is enabled
- * @return true if info logging is enabled, false if not
- */
- isInfoEnabled: function() {
- return this.isLogLevelEnabled('info');
- },
+ /**
+ * Log a message of log level 'info'
+ * @method
+ * @param {String} component Component that calls the log
+ * @param {String} message log message
+ */
+ info: function (component, message) {
+ this.log('info', component, message);
+ },
- /**
- * Check whether debug logging is enabled
- * @return true if debug logging is enabled, false if not
- */
- isDebugEnabled: function() {
- return this.isLogLevelEnabled('debug'