Skip to content

Commit

Permalink
hotfix: #1197 selection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Mar 28, 2023
1 parent 01d9361 commit a9949e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
*/
getSelection: function () {
const selection = this._shadowRoot && this._shadowRoot.getSelection ? this._shadowRoot.getSelection() : this._ww.getSelection();
if (!context.element.wysiwyg.contains(selection.focusNode)) {
if (!this._variable._range && !context.element.wysiwyg.contains(selection.focusNode)) {
selection.removeAllRanges();
selection.addRange(this._createDefaultRange());
}
Expand Down
2 changes: 2 additions & 0 deletions test/dev/suneditor_build_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ <h3>The Suneditor is based on pure JavaScript, with no dependencies.</h3>
<button type="button" class="btn btn-md btn-success" onclick="sun_destroy()">Destroy</button>
<button type="button" class="btn btn-md btn-success" onclick="sun_create()">Create</button>
<br><br>

afdsafdsja dasi fjdsaio j47vn w8994y r8943pvby49p y9p

<!-- images-->
<textarea id="editor2" style="width: 1080px; height: 200px;">
Expand Down

0 comments on commit a9949e2

Please sign in to comment.