diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.coffee b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.coffee
deleted file mode 100644
index 76eb5a04cf..0000000000
--- a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.coffee
+++ /dev/null
@@ -1,28 +0,0 @@
-# Hallo - a rich text editing jQuery UI widget
-# (c) 2011 Henri Bergius, IKS Consortium
-# Hallo may be freely distributed under the MIT license
-((jQuery) ->
- jQuery.widget "IKS.hallohr",
- options:
- editable: null
- toolbar: null
- uuid: ''
- buttonCssClass: null
-
- populateToolbar: (toolbar) ->
- buttonset = jQuery ""
-
- buttonElement = jQuery ''
- buttonElement.hallobutton
- uuid: @options.uuid
- editable: @options.editable
- label: "Horizontal rule"
- command: "insertHorizontalRule"
- icon: "icon-horizontalrule"
- cssClass: @options.buttonCssClass
- buttonset.append buttonElement
-
- buttonset.hallobuttonset()
- toolbar.append buttonset
-
-)(jQuery)
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.js b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.js
new file mode 100644
index 0000000000..0989d1fc66
--- /dev/null
+++ b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-hr.js
@@ -0,0 +1,31 @@
+// Generated by CoffeeScript 1.6.2
+(function() {
+ (function(jQuery) {
+ return jQuery.widget("IKS.hallohr", {
+ options: {
+ editable: null,
+ toolbar: null,
+ uuid: '',
+ buttonCssClass: null
+ },
+ populateToolbar: function(toolbar) {
+ var buttonElement, buttonset;
+
+ buttonset = jQuery("");
+ buttonElement = jQuery('');
+ buttonElement.hallobutton({
+ uuid: this.options.uuid,
+ editable: this.options.editable,
+ label: "Horizontal rule",
+ command: "insertHorizontalRule",
+ icon: "icon-horizontalrule",
+ cssClass: this.options.buttonCssClass
+ });
+ buttonset.append(buttonElement);
+ buttonset.hallobuttonset();
+ return toolbar.append(buttonset);
+ }
+ });
+ })(jQuery);
+
+}).call(this);
\ No newline at end of file
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee
deleted file mode 100644
index fbc405f8a2..0000000000
--- a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee
+++ /dev/null
@@ -1,68 +0,0 @@
-# plugin for hallo.js to allow inserting links using Wagtail's page chooser
-
-(($) ->
- $.widget "IKS.hallowagtaillink",
- options:
- uuid: ''
- editable: null
-
- populateToolbar: (toolbar) ->
- widget = this
-
- getEnclosingLink = () ->
- # if cursor is currently within a link element, return it, otherwise return null
- node = widget.options.editable.getSelection().commonAncestorContainer
- return $(node).parents('a').get(0)
-
- # Create an element for holding the button
- button = $('')
- button.hallobutton
- uuid: @options.uuid
- editable: @options.editable
- label: 'Links'
- icon: 'icon-link'
- command: null
- queryState: (event) ->
- button.hallobutton('checked', !!getEnclosingLink())
-
- # Append the button to toolbar
- toolbar.append button
-
- button.on "click", (event) ->
- enclosingLink = getEnclosingLink()
- if enclosingLink
- # remove existing link
- $(enclosingLink).replaceWith(enclosingLink.innerHTML)
- button.hallobutton('checked', false)
- widget.options.editable.element.trigger('change')
- else
- # commence workflow to add a link
- lastSelection = widget.options.editable.getSelection()
-
- if lastSelection.collapsed
- # TODO: don't hard-code this, as it may be changed in urls.py
- url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true'
- else
- url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true'
-
- ModalWorkflow
- url: url
- responses:
- pageChosen: (pageData) ->
- a = document.createElement('a')
- a.setAttribute('href', pageData.url)
- if pageData.id
- a.setAttribute('data-id', pageData.id)
- a.setAttribute('data-linktype', 'page')
-
- if (not lastSelection.collapsed) and lastSelection.canSurroundContents()
- # use the selected content as the link text
- lastSelection.surroundContents(a)
- else
- # no text is selected, so use the page title as link text
- a.appendChild(document.createTextNode pageData.title)
- lastSelection.insertNode(a)
-
- widget.options.editable.element.trigger('change')
-
-)(jQuery)
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js
new file mode 100644
index 0000000000..03732110d1
--- /dev/null
+++ b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js
@@ -0,0 +1,74 @@
+// Generated by CoffeeScript 1.6.2
+(function() {
+ (function($) {
+ return $.widget("IKS.hallowagtaillink", {
+ options: {
+ uuid: '',
+ editable: null
+ },
+ populateToolbar: function(toolbar) {
+ var button, getEnclosingLink, widget;
+
+ widget = this;
+ getEnclosingLink = function() {
+ var node;
+
+ node = widget.options.editable.getSelection().commonAncestorContainer;
+ return $(node).parents('a').get(0);
+ };
+ button = $('');
+ button.hallobutton({
+ uuid: this.options.uuid,
+ editable: this.options.editable,
+ label: 'Links',
+ icon: 'icon-link',
+ command: null,
+ queryState: function(event) {
+ return button.hallobutton('checked', !!getEnclosingLink());
+ }
+ });
+ toolbar.append(button);
+ return button.on("click", function(event) {
+ var enclosingLink, lastSelection, url;
+
+ enclosingLink = getEnclosingLink();
+ if (enclosingLink) {
+ $(enclosingLink).replaceWith(enclosingLink.innerHTML);
+ button.hallobutton('checked', false);
+ return widget.options.editable.element.trigger('change');
+ } else {
+ lastSelection = widget.options.editable.getSelection();
+ if (lastSelection.collapsed) {
+ url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true';
+ } else {
+ url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true';
+ }
+ return ModalWorkflow({
+ url: url,
+ responses: {
+ pageChosen: function(pageData) {
+ var a;
+
+ a = document.createElement('a');
+ a.setAttribute('href', pageData.url);
+ if (pageData.id) {
+ a.setAttribute('data-id', pageData.id);
+ a.setAttribute('data-linktype', 'page');
+ }
+ if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
+ lastSelection.surroundContents(a);
+ } else {
+ a.appendChild(document.createTextNode(pageData.title));
+ lastSelection.insertNode(a);
+ }
+ return widget.options.editable.element.trigger('change');
+ }
+ }
+ });
+ }
+ });
+ }
+ });
+ })(jQuery);
+
+}).call(this);
\ No newline at end of file
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
index 518a2c59b4..da26289664 100644
--- a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
@@ -13,16 +13,16 @@
-
-
-
-
-
+
+
+
+
+
{% comment %}
- TODO: have a mechanism to specify image-chooser.js (and hallo-wagtailimage.coffee)
+ TODO: have a mechanism to specify image-chooser.js (and hallo-wagtailimage.js)
within the wagtailimages app -
ideally wagtailadmin shouldn't have to know anything at all about wagtailimages
TODO: a method of injecting these sorts of things on demand when the modal is spawned.
diff --git a/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.coffee b/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.coffee
deleted file mode 100644
index 7e961444d3..0000000000
--- a/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.coffee
+++ /dev/null
@@ -1,45 +0,0 @@
-# plugin for hallo.js to allow inserting links using Wagtail's page chooser
-
-(($) ->
- $.widget "IKS.hallowagtaildoclink",
- options:
- uuid: ''
- editable: null
-
- populateToolbar: (toolbar) ->
- widget = this
-
- # Create an element for holding the button
- button = $('')
- button.hallobutton
- uuid: @options.uuid
- editable: @options.editable
- label: 'Documents'
- icon: 'icon-file-text-alt'
- command: null
-
- # Append the button to toolbar
- toolbar.append button
-
- button.on "click", (event) ->
- lastSelection = widget.options.editable.getSelection()
- ModalWorkflow
- url: window.chooserUrls.documentChooser
- responses:
- documentChosen: (docData) ->
- a = document.createElement('a')
- a.setAttribute('href', docData.url)
- a.setAttribute('data-id', docData.id)
- a.setAttribute('data-linktype', 'document')
-
- if (not lastSelection.collapsed) and lastSelection.canSurroundContents()
- # use the selected content as the link text
- lastSelection.surroundContents(a)
- else
- # no text is selected, so use the doc title as link text
- a.appendChild(document.createTextNode docData.title)
- lastSelection.insertNode(a)
-
- widget.options.editable.element.trigger('change')
-
-)(jQuery)
diff --git a/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js b/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js
new file mode 100644
index 0000000000..8f713a711b
--- /dev/null
+++ b/wagtail/wagtaildocs/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js
@@ -0,0 +1,51 @@
+// Generated by CoffeeScript 1.6.2
+(function() {
+ (function($) {
+ return $.widget("IKS.hallowagtaildoclink", {
+ options: {
+ uuid: '',
+ editable: null
+ },
+ populateToolbar: function(toolbar) {
+ var button, widget;
+
+ widget = this;
+ button = $('');
+ button.hallobutton({
+ uuid: this.options.uuid,
+ editable: this.options.editable,
+ label: 'Documents',
+ icon: 'icon-file-text-alt',
+ command: null
+ });
+ toolbar.append(button);
+ return button.on("click", function(event) {
+ var lastSelection;
+
+ lastSelection = widget.options.editable.getSelection();
+ return ModalWorkflow({
+ url: window.chooserUrls.documentChooser,
+ responses: {
+ documentChosen: function(docData) {
+ var a;
+
+ a = document.createElement('a');
+ a.setAttribute('href', docData.url);
+ a.setAttribute('data-id', docData.id);
+ a.setAttribute('data-linktype', 'document');
+ if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
+ lastSelection.surroundContents(a);
+ } else {
+ a.appendChild(document.createTextNode(docData.title));
+ lastSelection.insertNode(a);
+ }
+ return widget.options.editable.element.trigger('change');
+ }
+ }
+ });
+ });
+ }
+ });
+ })(jQuery);
+
+}).call(this);
\ No newline at end of file
diff --git a/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.coffee b/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.coffee
deleted file mode 100644
index 99e844f8d2..0000000000
--- a/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.coffee
+++ /dev/null
@@ -1,36 +0,0 @@
-# plugin for hallo.js to allow inserting embeds
-
-(($) ->
- $.widget "IKS.hallowagtailembeds",
- options:
- uuid: ''
- editable: null
-
- populateToolbar: (toolbar) ->
- widget = this
-
- # Create an element for holding the button
- button = $('')
- button.hallobutton
- uuid: @options.uuid
- editable: @options.editable
- label: 'Embed'
- icon: 'icon-media'
- command: null
-
- # Append the button to toolbar
- toolbar.append button
-
- button.on "click", (event) ->
- lastSelection = widget.options.editable.getSelection()
- insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last()
- ModalWorkflow
- url: window.chooserUrls.embedsChooser
- responses:
- embedChosen: (embedData) ->
- elem = $(embedData).get(0)
- lastSelection.insertNode(elem)
- if elem.getAttribute('contenteditable') == 'false'
- insertRichTextDeleteControl(elem)
- widget.options.editable.element.trigger('change')
-)(jQuery)
diff --git a/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js b/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js
new file mode 100644
index 0000000000..eb9f1e05a1
--- /dev/null
+++ b/wagtail/wagtailembeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js
@@ -0,0 +1,47 @@
+// Generated by CoffeeScript 1.6.2
+(function() {
+ (function($) {
+ return $.widget("IKS.hallowagtailembeds", {
+ options: {
+ uuid: '',
+ editable: null
+ },
+ populateToolbar: function(toolbar) {
+ var button, widget;
+
+ widget = this;
+ button = $('');
+ button.hallobutton({
+ uuid: this.options.uuid,
+ editable: this.options.editable,
+ label: 'Embed',
+ icon: 'icon-media',
+ command: null
+ });
+ toolbar.append(button);
+ return button.on("click", function(event) {
+ var insertionPoint, lastSelection;
+
+ lastSelection = widget.options.editable.getSelection();
+ insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
+ return ModalWorkflow({
+ url: window.chooserUrls.embedsChooser,
+ responses: {
+ embedChosen: function(embedData) {
+ var elem;
+
+ elem = $(embedData).get(0);
+ lastSelection.insertNode(elem);
+ if (elem.getAttribute('contenteditable') === 'false') {
+ insertRichTextDeleteControl(elem);
+ }
+ return widget.options.editable.element.trigger('change');
+ }
+ }
+ });
+ });
+ }
+ });
+ })(jQuery);
+
+}).call(this);
\ No newline at end of file
diff --git a/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.coffee b/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.coffee
deleted file mode 100644
index 4a4bcaf7ad..0000000000
--- a/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.coffee
+++ /dev/null
@@ -1,39 +0,0 @@
-# plugin for hallo.js to allow inserting images from the Wagtail image library
-
-(($) ->
- $.widget "IKS.hallowagtailimage",
- options:
- uuid: ''
- editable: null
-
- populateToolbar: (toolbar) ->
- widget = this
-
- # Create an element for holding the button
- button = $('')
- button.hallobutton
- uuid: @options.uuid
- editable: @options.editable
- label: 'Images'
- icon: 'icon-picture'
- command: null
-
- # Append the button to toolbar
- toolbar.append button
-
- button.on "click", (event) ->
- lastSelection = widget.options.editable.getSelection()
- insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last()
- ModalWorkflow
- url: window.chooserUrls.imageChooser + '?select_format=true'
- responses:
- imageChosen: (imageData) ->
- elem = $(imageData.html).get(0)
-
- lastSelection.insertNode(elem)
-
- if elem.getAttribute('contenteditable') == 'false'
- insertRichTextDeleteControl(elem)
- widget.options.editable.element.trigger('change')
-
-)(jQuery)
diff --git a/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js b/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js
new file mode 100644
index 0000000000..a0c9bb14b0
--- /dev/null
+++ b/wagtail/wagtailimages/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js
@@ -0,0 +1,47 @@
+// Generated by CoffeeScript 1.6.2
+(function() {
+ (function($) {
+ return $.widget("IKS.hallowagtailimage", {
+ options: {
+ uuid: '',
+ editable: null
+ },
+ populateToolbar: function(toolbar) {
+ var button, widget;
+
+ widget = this;
+ button = $('');
+ button.hallobutton({
+ uuid: this.options.uuid,
+ editable: this.options.editable,
+ label: 'Images',
+ icon: 'icon-picture',
+ command: null
+ });
+ toolbar.append(button);
+ return button.on("click", function(event) {
+ var insertionPoint, lastSelection;
+
+ lastSelection = widget.options.editable.getSelection();
+ insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
+ return ModalWorkflow({
+ url: window.chooserUrls.imageChooser + '?select_format=true',
+ responses: {
+ imageChosen: function(imageData) {
+ var elem;
+
+ elem = $(imageData.html).get(0);
+ lastSelection.insertNode(elem);
+ if (elem.getAttribute('contenteditable') === 'false') {
+ insertRichTextDeleteControl(elem);
+ }
+ return widget.options.editable.element.trigger('change');
+ }
+ }
+ });
+ });
+ }
+ });
+ })(jQuery);
+
+}).call(this);
\ No newline at end of file