0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Add config.addLinks

This commit is contained in:
Limon Monte 2019-12-23 01:04:04 +02:00 committed by Neil Jenkins
parent 9218c9ba14
commit 1850e2cdae
2 changed files with 8 additions and 3 deletions

View file

@ -187,7 +187,8 @@ proto.setConfig = function ( config ) {
sanitizeToDOMFragment:
typeof DOMPurify !== 'undefined' && DOMPurify.isSupported ?
sanitizeToDOMFragment : null,
willCutCopy: null
willCutCopy: null,
addLinks: true
}, config, true );
// Users may specify block tag in lower case

View file

@ -153,7 +153,9 @@ var handleEnter = function ( self, shiftKey, range ) {
// Remove any zws so we don't think there's content in an empty
// block.
self._recordUndoState( range );
if ( self._config.addLinks ) {
addLinks( range.startContainer, root, self );
}
self._removeZWS();
self._getRangeAndRemoveBookmark( range );
@ -504,7 +506,9 @@ var keyHandlers = {
var node, parent;
var root = self._root;
self._recordUndoState( range );
if ( self._config.addLinks ) {
addLinks( range.startContainer, root, self );
}
self._getRangeAndRemoveBookmark( range );
// If the cursor is at the end of a link (<a>foo|</a>) then move it