Fix scroll issue with dropdown menus in rich text

pull/1/head
yflory 4 years ago
parent 006a4ae144
commit 3ff6a1a11c

@ -1,6 +1,8 @@
define(['jquery'], function ($) { define(['jquery'], function ($) {
var CKEDITOR = window.CKEDITOR; var CKEDITOR = window.CKEDITOR;
var $iframe = $('iframe').contents().find('html');
$('body').on('click', '.cke_dialog_container a.cke_specialchar', function (e) { $('body').on('click', '.cke_dialog_container a.cke_specialchar', function (e) {
e.preventDefault(); e.preventDefault();
var attr = $(e.currentTarget).attr('oonclick'); var attr = $(e.currentTarget).attr('oonclick');
@ -8,11 +10,11 @@ define(['jquery'], function ($) {
var reg = /CKEDITOR.tools.callFunction\(([0-9]+), this\);/; var reg = /CKEDITOR.tools.callFunction\(([0-9]+), this\);/;
var m = attr.match(reg); var m = attr.match(reg);
if (!m) { return; } if (!m) { return; }
var s = $iframe.scrollTop();
CKEDITOR.tools.callFunction(Number(m[1]), e.currentTarget); CKEDITOR.tools.callFunction(Number(m[1]), e.currentTarget);
$iframe.scrollTop(s);
}); });
var $iframe = $('iframe').contents().find('html');
// Buttons // Buttons
var $a = $('.cke_toolbox_main').find('.cke_button, .cke_combo_button'); var $a = $('.cke_toolbox_main').find('.cke_button, .cke_combo_button');
$a.each(function (i, el) { $a.each(function (i, el) {
@ -100,7 +102,9 @@ define(['jquery'], function ($) {
if (!match) { return; } if (!match) { return; }
var f = match[1]; var f = match[1];
var el = match[2] !== "null" ? match[2] : null; var el = match[2] !== "null" ? match[2] : null;
var s = $iframe.scrollTop();
CKEDITOR.tools.callFunction(Number(f), el, match[4]); CKEDITOR.tools.callFunction(Number(f), el, match[4]);
$iframe.scrollTop(s);
}); });
// Register the CKEDITOR global. // Register the CKEDITOR global.

@ -1065,18 +1065,6 @@ define([
require(['/pad/csp.js'], waitFor()); require(['/pad/csp.js'], waitFor());
}).nThen(function( /*waitFor*/ ) { }).nThen(function( /*waitFor*/ ) {
function launchAnchorTest(test) { function launchAnchorTest(test) {
// -------- anchor test: make sure the exported anchor contains <a name="..."> ------- // -------- anchor test: make sure the exported anchor contains <a name="..."> -------
console.log('---- anchor test: make sure the exported anchor contains <a name="..."> -----.'); console.log('---- anchor test: make sure the exported anchor contains <a name="..."> -----.');

Loading…
Cancel
Save