mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-02 20:44:53 +00:00
Add data-hallo-editor data attribute as integration point for Hallo plugins
This commit is contained in:
parent
2e9b5e5569
commit
7d10279ed6
4 changed files with 6 additions and 6 deletions
|
|
@ -54,7 +54,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
|||
// focus first suitable input found
|
||||
var timeout = setTimeout(function() {
|
||||
var $input = $('.input', self.container);
|
||||
var $firstField = $('input, textarea, .halloeditor, [data-draftail-input]', $input).first();
|
||||
var $firstField = $('input, textarea, [data-hallo-editor], [data-draftail-input]', $input).first();
|
||||
|
||||
if ($firstField.is('[data-draftail-input]')) {
|
||||
$firstField.get(0).draftailEditor.focus();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
function makeHalloRichTextEditable(id, plugins) {
|
||||
var input = $('#' + id);
|
||||
var editor = $('<div class="halloeditor"></div>').html(input.val());
|
||||
var editor = $('<div class="halloeditor" data-hallo-editor></div>').html(input.val());
|
||||
editor.insertBefore(input);
|
||||
input.hide();
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ function insertRichTextDeleteControl(elem) {
|
|||
var a = $('<a class="icon icon-cross text-replace halloembed__delete">Delete</a>');
|
||||
$(elem).addClass('halloembed').prepend(a);
|
||||
a.on('click', function() {
|
||||
var widget = $(elem).parent('.halloeditor').data('IKS-hallo');
|
||||
var widget = $(elem).parent('[data-hallo-editor]').data('IKS-hallo');
|
||||
$(elem).fadeOut(function() {
|
||||
$(elem).remove();
|
||||
if (widget != undefined && widget.options.editable) {
|
||||
|
|
@ -89,7 +89,7 @@ function insertRichTextDeleteControl(elem) {
|
|||
}
|
||||
|
||||
$(function() {
|
||||
$('.halloeditor [contenteditable="false"]').each(function() {
|
||||
$('[data-hallo-editor] [contenteditable="false"]').each(function() {
|
||||
insertRichTextDeleteControl(this);
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
var insertionPoint, lastSelection;
|
||||
|
||||
lastSelection = widget.options.editable.getSelection();
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.halloeditor').last();
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('[data-hallo-editor]').last();
|
||||
|
||||
return ModalWorkflow({
|
||||
url: window.chooserUrls.embedsChooser,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
var insertionPoint, lastSelection;
|
||||
|
||||
lastSelection = widget.options.editable.getSelection();
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.halloeditor').last();
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('[data-hallo-editor]').last();
|
||||
return ModalWorkflow({
|
||||
url: window.chooserUrls.imageChooser + '?select_format=true',
|
||||
responses: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue