Skip to content

Commit

Permalink
fixes #896 - removed forgotten code which was just for experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
Yair Even Or authored and Yair Even Or committed Sep 18, 2021
1 parent 75384da commit 81e45d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 45 deletions.
23 changes: 2 additions & 21 deletions dist/tagify.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -1395,27 +1395,8 @@
break;
}
// currently commented to allow new lines in mixed-mode

case 'Enter':
// e.preventDefault(); // solves Chrome bug - http://stackoverflow.com/a/20398191/104380
setTimeout(() => {
var selection = window.getSelection(),
nodeAtCaret = selection.anchorNode;
nodeAtCaret.parentElement.closest('.' + _s.classNames.tag); // if( nodeAtCaret.outerHTML == '<div><br></div>' ){
// var brElm = document.createElement('br')
// nodeAtCaret.replaceWith(brElm)
// }
// if the current caret is withint a text node which isn't a part of a tag, place the caret outside
// if(!isNodeAtCaretInsideTag && nodeAtCaret){
// if( nodeAtCaret.children.length == '1' && nodeAtCaret.firstElementChild ){
// console.log(111, nodeAtCaret)
// var brElm = document.createElement('br');
// console.log( nodeAtCaret.replaceWith(brElm) )
// // this.placeCaretAfterNode(nodeAtCaret)
// }
// }
}, 0);
break;
// case 'Enter' :
// // e.preventDefault(); // solves Chrome bug - http://stackoverflow.com/a/20398191/104380
}

return true;
Expand Down
26 changes: 2 additions & 24 deletions src/parts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,8 @@ export default {
break;
}
// currently commented to allow new lines in mixed-mode
case 'Enter' :
// e.preventDefault(); // solves Chrome bug - http://stackoverflow.com/a/20398191/104380
setTimeout(() => {

var selection = window.getSelection(),
nodeAtCaret = selection.anchorNode,
isNodeAtCaretInsideTag = nodeAtCaret.parentElement.closest('.' + _s.classNames.tag)

// if( nodeAtCaret.outerHTML == '<div><br></div>' ){
// var brElm = document.createElement('br')
// nodeAtCaret.replaceWith(brElm)
// }

// if the current caret is withint a text node which isn't a part of a tag, place the caret outside
// if(!isNodeAtCaretInsideTag && nodeAtCaret){
// if( nodeAtCaret.children.length == '1' && nodeAtCaret.firstElementChild ){
// console.log(111, nodeAtCaret)
// var brElm = document.createElement('br');
// console.log( nodeAtCaret.replaceWith(brElm) )
// // this.placeCaretAfterNode(nodeAtCaret)
// }
// }
}, 0);
break;
// case 'Enter' :
// // e.preventDefault(); // solves Chrome bug - http://stackoverflow.com/a/20398191/104380
}

return true
Expand Down

0 comments on commit 81e45d0

Please sign in to comment.