mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Added === text expansion for paywall card
refs https://github.com/TryGhost/Team/issues/466
This commit is contained in:
parent
3826f39f9c
commit
c9dc56841b
@ -449,6 +449,28 @@ export default function (mobiledocEditor, koenig) {
|
||||
}
|
||||
});
|
||||
|
||||
/* non-markdown expansions -----------------------------------------------*/
|
||||
|
||||
mobiledocEditor.onTextInput({
|
||||
name: 'paywall',
|
||||
match: /^===$/,
|
||||
run(editor) {
|
||||
let {range: {head, head: {section}}} = editor;
|
||||
|
||||
// Skip if cursor is not at end of section
|
||||
if (!head.isTail()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if section is a list item
|
||||
if (section.isListItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
koenig.send('replaceWithCardSection', 'paywall', section.toRange());
|
||||
}
|
||||
});
|
||||
|
||||
/* inline markdown -------------------------------------------------------*/
|
||||
|
||||
// must come after block expansions so that the smart hyphens expansion
|
||||
|
Loading…
Reference in New Issue
Block a user