Fix anchor links in rich text

pull/1/head
yflory 4 years ago
parent 1c2ea4c4be
commit 353ec99bc7

@ -18,14 +18,20 @@ define([
e.preventDefault();
e.stopPropagation();
var open = function () {
if (href[0] === '#') {
var anchor = $inner.find(href);
if (!anchor.length) { return; }
anchor[0].scrollIntoView();
try {
$inner.find('.cke_anchor[data-cke-realelement]').each(function (j, el) {
var i = editor.restoreRealElement($(el));
var node = i.$;
if (node.id === href.slice(1)) {
el.scrollIntoView();
}
});
} catch (err) {}
return;
}
var open = function () {
var bounceHref = window.location.origin + '/bounce/#' + encodeURIComponent(href);
window.open(bounceHref);
};
@ -39,7 +45,10 @@ define([
var l = (rect.left - rect0.left)+'px';
var t = rect.bottom + $iframe.scrollTop() +'px';
var a = h('a', { href: href}, href);
var text = href;
Messages.pad_goToAnchor = "Go to anchor"; // XXX
if (text[0] === '#') { text = Messages.pad_goToAnchor; }
var a = h('a', { href: href}, text);
var link = h('div.cp-link-clicked.non-realtime', {
contenteditable: false,
style: 'top:'+t+';left:'+l

Loading…
Cancel
Save