FIX: Ability to trigger emoji after indented code block (#18478)
This commit is contained in:
parent
94aba90c56
commit
15f192447b
|
@ -460,18 +460,18 @@ export function postRNWebviewMessage(prop, value) {
|
|||
}
|
||||
|
||||
const CODE_BLOCKS_REGEX =
|
||||
/^( |\t).*|`[^`]+`|^```[^]*?^```|\[code\][^]*?\[\/code\]/gm;
|
||||
// | ^ | ^ | ^ | ^ |
|
||||
// | | | |
|
||||
// | | | code blocks between [code]
|
||||
// | | |
|
||||
// | | +--- code blocks between three backticks
|
||||
// | |
|
||||
// | +----- inline code between backticks
|
||||
// |
|
||||
// +------- paragraphs starting with 4 spaces or tab
|
||||
/^( |\t).*|`[^`]+`|^```[^]*?^```|\[code\][^]*?\[\/code\]/gm;
|
||||
//| ^ | ^ | ^ | ^ |
|
||||
// | | | |
|
||||
// | | | code blocks between [code]
|
||||
// | | |
|
||||
// | | +--- code blocks between three backticks
|
||||
// | |
|
||||
// | +----- inline code between backticks
|
||||
// |
|
||||
// +------- paragraphs starting with 2 spaces or tab
|
||||
|
||||
const OPEN_CODE_BLOCKS_REGEX = /`[^`]+|^```[^]*?|\[code\][^]*?/gm;
|
||||
const OPEN_CODE_BLOCKS_REGEX = /^( |\t).*|`[^`]+|^```[^]*?|\[code\][^]*?/gm;
|
||||
|
||||
export function inCodeBlock(text, pos) {
|
||||
let end = 0;
|
||||
|
|
|
@ -271,18 +271,23 @@ discourseModule("Unit | Utilities", function () {
|
|||
|
||||
test("inCodeBlock", function (assert) {
|
||||
const texts = [
|
||||
// closed code blocks
|
||||
// CLOSED CODE BLOCKS:
|
||||
"000\n\n 111\n\n000",
|
||||
"000 `111` 000",
|
||||
"000\n```\n111\n```\n000",
|
||||
"000\n[code]111[/code]\n000",
|
||||
// open code blocks
|
||||
// OPEN CODE BLOCKS:
|
||||
"000\n\n 111",
|
||||
"000 `111",
|
||||
"000\n```\n111",
|
||||
"000\n[code]111",
|
||||
// complex test
|
||||
// COMPLEX TEST:
|
||||
"000\n\n```\n111\n```\n\n000\n\n`111 111`\n\n000\n\n[code]\n111\n[/code]\n\n 111\n\t111\n\n000`111",
|
||||
// INDENTED OPEN CODE BLOCKS:
|
||||
// - Using tab
|
||||
"000\n\t```111\n\t111\n\t111```\n000",
|
||||
// - Using spaces
|
||||
`000\n \`\`\`111\n 111\n 111\`\`\`\n000`,
|
||||
];
|
||||
|
||||
texts.forEach((text) => {
|
||||
|
|
Loading…
Reference in New Issue