Fix mediatags in comments

pull/1/head
yflory 5 years ago
parent a8eeac6e5a
commit 8e4ede3bb8

@ -2,22 +2,27 @@
var CKEDITOR = window.CKEDITOR; var CKEDITOR = window.CKEDITOR;
function isUnstylable (el) { function isUnstylable (el) {
if (el.hasClass('cke_widget_mediatag')) {
return false;
}
var b = el.getAttribute( 'contentEditable' ) === 'false' || var b = el.getAttribute( 'contentEditable' ) === 'false' ||
el.getAttribute( 'data-nostyle' ); el.getAttribute( 'data-nostyle' );
return b; return b;
} }
var color1 = 'rgba(252, 165, 3, 0.8);'; var color1 = 'rgba(252, 165, 3, 0.8)';
var color2 = 'rgba(252, 231, 3, 0.8);'; var color2 = 'rgba(252, 231, 3, 0.8)';
CKEDITOR.plugins.add('comments', { CKEDITOR.plugins.add('comments', {
//requires: 'dialog,widget', //requires: 'dialog,widget',
//icons: 'image', //icons: 'image',
//hidpi: true, //hidpi: true,
onLoad: function () { onLoad: function () {
CKEDITOR.addCss('comment { background-color: '+color1+' }' + CKEDITOR.addCss('comment { background-color: '+color1+'; }' +
'@keyframes color { 0% { background-color: '+color2+' } 50% { background-color: '+color1+' } 100% { background-color: '+color2+' } }' + '@keyframes color { 0% { background-color: '+color2+'; } 50% { background-color: '+color1+'; } 100% { background-color: '+color2+'; } }' +
'comment.active { animation-name: color; animation-duration: 1s; animation-iteration-count: 2; background-color: '+color2+' outline: none;}' + 'comment.active { animation-name: color; animation-duration: 1s; animation-iteration-count: 2; background-color: '+color2+'; outline: none;}' +
'comment media-tag { border: 2px solid '+color1+' !important; }' +
'comment.active media-tag { border: 2px solid '+color2+' !important; }' +
'comment * { background-color: transparent !important; }'); 'comment * { background-color: transparent !important; }');
}, },
init: function (editor) { init: function (editor) {

@ -357,7 +357,7 @@ define([
var uids = Env.$inner.find('comment').map(function (i, el) { var uids = Env.$inner.find('comment').map(function (i, el) {
var id = el.getAttribute('data-uid'); var id = el.getAttribute('data-uid');
// Empty comment: remove from dom // Empty comment: remove from dom
if (!el.innerText && el.parentElement) { if (!el.innerHTML && el.parentElement) {
el.parentElement.removeChild(el); el.parentElement.removeChild(el);
changed = true; changed = true;
return; return;

Loading…
Cancel
Save