You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using SCEditor in a webapp used by authors to create travel guides. One of the features I want to put in is to allow the author to cross reference their guides - i.e. link to one of their other guides from the current one. The individual guides are identified via their unique identifier, referred to as einzig in my code. By dint of much trial and error - and reading other threads here - I have managed to get things (mostly)
where the process of inserting an external guide reference is triggered by the author selecting a guide name from a dropdown in the toolbar (that part of the code not shown here)
Everything works just fine - but for one issue. My call to editor.insert above appears to close the current paragraph, inserts a few <br> tags and new lines for good measure and then starts a new paragarph. Here, for example, is what I get
<p>Betty bought a bit <br /></p>\n<p><a class='guideJump' href='KJQiZBVvqOuC' data-einzig='KJQiZBVvqOuC'>Gudie</a> of butter but the bit of butter was bitter<br /><br /></p>\n
Why is this happening and how can I prevent it? That apart what is with all those unrequired break tags and newline characters?
The text was updated successfully, but these errors were encountered:
I am using SCEditor in a webapp used by authors to create travel guides. One of the features I want to put in is to allow the author to cross reference their guides - i.e. link to one of their other guides from the current one. The individual guides are identified via their unique identifier, referred to as
einzig
in my code. By dint of much trial and error - and reading other threads here - I have managed to get things (mostly)Here is my code
sceditor.formats.bbcode.set('guide',
{
tags:{a:{'data-einzig':null}},
allowedChildren:[],
allowEmpty:false,
isSelfClosing:false,
isInline:true,
isHTMLInline:true,
format:(e,c)=>{return
[guide einzig=${e.dataset.einzig}]${e.innerHTML}[/guide];},
html:(t,a,c) =>{return ``<a class='guideJump' href='${a.einzig}' data-einzig='${a.einzig}'>${c}</a>``;},
});
sceditor.formats.bbcode.set('url',{format:(e,c)=>{return c;}})
function jumpToGuide(e)
{
const editor = this,
tgt = e.target;
editor.insert(
[guide einzig='${tgt.dataset.einzig}']Gudie[/guide]);
editor.closeDropDown(true);
e.stopPropagation();
}
where the process of inserting an external guide reference is triggered by the author selecting a guide name from a dropdown in the toolbar (that part of the code not shown here)
Everything works just fine - but for one issue. My call to
editor.insert
above appears to close the current paragraph, inserts a few<br>
tags and new lines for good measure and then starts a new paragarph. Here, for example, is what I get<p>Betty bought a bit <br /></p>\n<p><a class='guideJump' href='KJQiZBVvqOuC' data-einzig='KJQiZBVvqOuC'>Gudie</a> of butter but the bit of butter was bitter<br /><br /></p>\n
Why is this happening and how can I prevent it? That apart what is with all those unrequired break tags and newline characters?
The text was updated successfully, but these errors were encountered: