mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix anchor links in rich text
This commit is contained in:
parent
1c2ea4c4be
commit
353ec99bc7
@ -18,14 +18,20 @@ define([
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (href[0] === '#') {
|
||||
var anchor = $inner.find(href);
|
||||
if (!anchor.length) { return; }
|
||||
anchor[0].scrollIntoView();
|
||||
return;
|
||||
}
|
||||
|
||||
var open = function () {
|
||||
if (href[0] === '#') {
|
||||
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 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…
Reference in New Issue
Block a user