Update all Hallo code to use .halloeditor class instead of .richtext

This commit is contained in:
Thibaud Colas 2018-01-11 14:04:48 +02:00
parent 72d06072d3
commit 9521f21359
8 changed files with 24 additions and 24 deletions

View file

@ -53,7 +53,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() {
$('.input input,.input textarea,.input .richtext', self.container).first().trigger('focus');
$('.input input,.input textarea,.input .halloeditor', self.container).first().trigger('focus');
}, 250);
};

View file

@ -2,8 +2,8 @@
function makeHalloRichTextEditable(id, plugins) {
var input = $('#' + id);
var richText = $('<div class="richtext"></div>').html(input.val());
richText.insertBefore(input);
var editor = $('<div class="halloeditor"></div>').html(input.val());
editor.insertBefore(input);
input.hide();
var removeStylingPending = false;
@ -12,7 +12,7 @@ function makeHalloRichTextEditable(id, plugins) {
(we don't remove the span entirely as that messes with the cursor position,
and spans will be removed anyway by our whitelisting)
*/
$('span[style]', richText).filter(function() {
$('span[style]', editor).filter(function() {
return this.attributes.length === 1;
}).removeAttr('style');
removeStylingPending = false;
@ -20,7 +20,7 @@ function makeHalloRichTextEditable(id, plugins) {
/* Workaround for faulty change-detection in hallo */
function setModified() {
var hallo = richText.data('IKS-hallo');
var hallo = editor.data('IKS-hallo');
if (hallo) {
hallo.setModified();
}
@ -29,7 +29,7 @@ function makeHalloRichTextEditable(id, plugins) {
var closestObj = input.closest('.object');
var isRoot = input.closest('.struct-block').length == 0;
richText.hallo({
editor.hallo({
toolbar: 'halloToolbarFixed',
toolbarCssClass: (closestObj.hasClass('full')) ? 'full' : (closestObj.hasClass('stream-field') && isRoot) ? 'stream-field' : '',
/* use the passed-in plugins arg */
@ -59,7 +59,7 @@ function makeHalloRichTextEditable(id, plugins) {
});
});
setupLinkTooltips(richText);
setupLinkTooltips(editor);
}
function setupLinkTooltips(elem) {
@ -76,9 +76,9 @@ function setupLinkTooltips(elem) {
function insertRichTextDeleteControl(elem) {
var a = $('<a class="icon icon-cross text-replace delete-control">Delete</a>');
$(elem).addClass('rich-text-deletable').prepend(a);
$(elem).addClass('halloeditor-deletable').prepend(a);
a.on('click', function() {
var widget = $(elem).parent('.richtext').data('IKS-hallo');
var widget = $(elem).parent('.halloeditor').data('IKS-hallo');
$(elem).fadeOut(function() {
$(elem).remove();
if (widget != undefined && widget.options.editable) {
@ -89,7 +89,7 @@ function insertRichTextDeleteControl(elem) {
}
$(function() {
$('.richtext [contenteditable="false"]').each(function() {
$('.halloeditor [contenteditable="false"]').each(function() {
insertRichTextDeleteControl(this);
});
})

View file

@ -53,7 +53,7 @@ label,
input,
textarea,
select,
.richtext,
.halloeditor,
.tagit {
box-sizing: border-box;
border-radius: 6px;
@ -896,7 +896,7 @@ li.focused > .help {
input,
textarea,
select,
.richtext,
.halloeditor,
.tagit {
border-radius: 3px;
padding: 0.4em 1em;

View file

@ -135,7 +135,7 @@ li.sequence-member {
// that are direct children of highest level sequence should be borderless and full-width
.block_field > .field-content > .input > .sequence-container > .sequence-container-inner > .sequence > .sequence-member > .sequence-member-inner {
> .widget-text_input input,
> .widget-hallo_rich_text_area .richtext,
> .widget-hallo_rich_text_area .halloeditor,
> .widget-textarea textarea {
border: 0;
padding: 0;

View file

@ -143,7 +143,7 @@
}
}
.richtext {
.halloeditor {
padding-top: 1em; // to provide space for editor buttons
padding-bottom: 1em;
@ -181,7 +181,7 @@
padding: 0;
}
.richtext {
.halloeditor {
padding-top: 3em; // to provide space for editor buttons
padding-bottom: 3em;
@ -199,7 +199,7 @@
.error,
.error input,
.error textarea,
.error .richtext {
.error .halloeditor {
background-color: $color-input-error-bg;
}
}
@ -332,7 +332,7 @@
// Custom styles that make some fields look more important
.full input,
.full textarea,
.full .richtext {
.full .halloeditor {
@include nice-padding();
border-radius: 0;
padding-top: 2em;
@ -343,7 +343,7 @@
.title input,
.title textarea,
.title .richtext {
.title .halloeditor {
font-size: 2em;
font-family: $font-serif;
}
@ -447,7 +447,7 @@ footer .preview {
input,
textarea,
.richtext {
.halloeditor {
border-width: 0 1px;
}

View file

@ -34,7 +34,7 @@
height: 2.4em;
}
.richtext {
.halloeditor {
font-family: $font-serif;
padding-top: 4em;
min-height: 50px;
@ -80,7 +80,7 @@
}
// Delete controls on embedded blocks with contenteditable='false'
.rich-text-deletable {
.halloeditor-deletable {
position: relative;
a.delete-control {
@ -100,7 +100,7 @@
}
&.inEditMode {
.rich-text-deletable a.delete-control {
.halloeditor-deletable a.delete-control {
display: block;
}
}

View file

@ -25,7 +25,7 @@
var insertionPoint, lastSelection;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.halloeditor').last();
return ModalWorkflow({
url: window.chooserUrls.embedsChooser,

View file

@ -23,7 +23,7 @@
var insertionPoint, lastSelection;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.halloeditor').last();
return ModalWorkflow({
url: window.chooserUrls.imageChooser + '?select_format=true',
responses: {