mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added === text expansion for paywall card
refs https://github.com/TryGhost/Team/issues/466
This commit is contained in:
parent
3826f39f9c
commit
c9dc56841b
1 changed files with 22 additions and 0 deletions
|
@ -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 -------------------------------------------------------*/
|
/* inline markdown -------------------------------------------------------*/
|
||||||
|
|
||||||
// must come after block expansions so that the smart hyphens expansion
|
// must come after block expansions so that the smart hyphens expansion
|
||||||
|
|
Loading…
Add table
Reference in a new issue