mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-01 02:25:45 +08:00
parent
948202af2d
commit
ede5d49280
2 changed files with 20 additions and 2 deletions
|
@ -81,6 +81,19 @@ describe('Contenteditable Integration Spec', function() {
|
||||||
}).then(done).catch(done.fail);
|
}).then(done).catch(done.fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Doesn't create unordered lists with dash when it's not at the start of the composer", (done) => {
|
||||||
|
this.ce.test({
|
||||||
|
keys: ['asdf', 'Space', 'Back space', '-', 'Space'],
|
||||||
|
expectedHTML: `<spelling class="misspelled">asdf</spelling>- `,
|
||||||
|
expectedSelectionResolver: (dom) => {
|
||||||
|
return {
|
||||||
|
node: dom.childNodes[1],
|
||||||
|
offset: 2,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}).then(done).catch(done.fail);
|
||||||
|
});
|
||||||
|
|
||||||
it('Undoes unordered list creation with backspace', (done) => {
|
it('Undoes unordered list creation with backspace', (done) => {
|
||||||
this.ce.test({
|
this.ce.test({
|
||||||
keys: ['-', 'Space', 'Back space'],
|
keys: ['-', 'Space', 'Back space'],
|
||||||
|
@ -192,6 +205,7 @@ describe('Contenteditable Integration Spec', function() {
|
||||||
expectedSelectionResolver: (dom) => {
|
expectedSelectionResolver: (dom) => {
|
||||||
return {
|
return {
|
||||||
node: dom.querySelectorAll('li')[0].childNodes[0],
|
node: dom.querySelectorAll('li')[0].childNodes[0],
|
||||||
|
offset: 1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}).then(done).catch(done.fail);
|
}).then(done).catch(done.fail);
|
||||||
|
@ -204,6 +218,7 @@ describe('Contenteditable Integration Spec', function() {
|
||||||
expectedSelectionResolver: (dom) => {
|
expectedSelectionResolver: (dom) => {
|
||||||
return {
|
return {
|
||||||
node: dom.querySelectorAll('li')[0].childNodes[0],
|
node: dom.querySelectorAll('li')[0].childNodes[0],
|
||||||
|
offset: 1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}).then(done).catch(done.fail);
|
}).then(done).catch(done.fail);
|
||||||
|
|
|
@ -40,8 +40,11 @@ class ListManager extends ContenteditableExtension
|
||||||
return false unless selection?.anchorNode
|
return false unless selection?.anchorNode
|
||||||
return false if not selection.isCollapsed
|
return false if not selection.isCollapsed
|
||||||
|
|
||||||
|
sibling = selection.anchorNode.previousElementSibling
|
||||||
|
if not sibling or DOMUtils.looksLikeBlockElement(sibling)
|
||||||
text = selection.anchorNode.textContent
|
text = selection.anchorNode.textContent
|
||||||
return @numberRegex().test(text) or @bulletRegex().test(text)
|
return @numberRegex().test(text) or @bulletRegex().test(text)
|
||||||
|
else return false
|
||||||
|
|
||||||
@createList: (editor) ->
|
@createList: (editor) ->
|
||||||
text = editor.currentSelection().anchorNode?.textContent
|
text = editor.currentSelection().anchorNode?.textContent
|
||||||
|
|
Loading…
Reference in a new issue