Skip to content

Commit

Permalink
New version 4.0.0-beta.94 Read more https://github.com/xdan/jodit/blo…
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Oct 21, 2023
1 parent 91b7b97 commit c285c06
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jodit",
"version": "4.0.0-beta.93",
"version": "4.0.0-beta.94",
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
"main": "build/jodit.min.js",
"types": "./types/index.d.ts",
Expand Down
12 changes: 7 additions & 5 deletions src/core/selection/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,13 +1161,15 @@ export class Selection implements ISelect {
}
}

if (!Dom.isTag(start || last, INSEPARABLE_TAGS)) {
range.selectNodeContents(start || last);
const workElm = start || last;

if (!Dom.isTag(workElm, INSEPARABLE_TAGS)) {
range.selectNodeContents(workElm);
range.collapse(inStart);
} else {
inStart || Dom.isTag(start || last, 'br')
? range.setStartBefore(start || last)
: range.setEndAfter(last);
inStart || Dom.isTag(workElm, 'br')
? range.setStartBefore(workElm)
: range.setEndAfter(workElm);
range.collapse(inStart);
}

Expand Down
13 changes: 9 additions & 4 deletions src/plugins/backspace/backspace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ describe('Backspace/Delete key', function () {
});

describe('Position after backspace', () => {
it.only('Should be correct', async () => {
it('Should be correct', async () => {
editor.focus();
editor.value = '<p><strong><span>&nbsp;</span></strong><br></p><p><strong><span>|&nbsp;</span></strong><br></p>';
editor.value =
'<p><strong><span>&nbsp;</span></strong><br></p><p><strong><span>|&nbsp;</span></strong><br></p>';
setCursorToChar(editor);

simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
Expand Down Expand Up @@ -646,14 +647,18 @@ describe('Backspace/Delete key', function () {
);

editor.s.insertHTML('b');
expect(editor.value).equals('<p><br></p><p>b</p>');
replaceCursorToChar(editor);
expect(editor.value).equals('<p><br></p><p>b|</p>');
setCursorToChar(editor);

simulateEvent(
'keydown',
Jodit.KEY_BACKSPACE,
editor.editor
);
expect(editor.value).equals('<p><br></p><p><br></p>');
replaceCursorToChar(editor);
expect(editor.value).equals('<p><br></p><p>|<br></p>');
setCursorToChar(editor);

simulateEvent(
'keydown',
Expand Down

0 comments on commit c285c06

Please sign in to comment.