Revert "FIX: fast-edit should fall back to composer for non-ascii characters (#21453)" (#21454)

This reverts commit 249f4296bf.
This commit is contained in:
Martin Brennan 2023-05-09 15:40:17 +02:00 committed by GitHub
parent d1e4e7cd6f
commit b5292c8139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 16 deletions

View File

@ -165,14 +165,12 @@ export default Component.extend(KeyEnterEscape, {
if (this._canEditPost) { if (this._canEditPost) {
const regexp = new RegExp(escapeRegExp(quoteState.buffer), "gi"); const regexp = new RegExp(escapeRegExp(quoteState.buffer), "gi");
const matches = cooked.innerHTML.match(regexp); const matches = cooked.innerHTML.match(regexp);
const non_ascii_regex = /[^\x00-\x7F]/;
if ( if (
quoteState.buffer.length < 1 || quoteState.buffer.length < 1 ||
quoteState.buffer.includes("|") || // tables are too complex quoteState.buffer.includes("|") || // tables are too complex
quoteState.buffer.match(/\n/g) || // linebreaks are too complex quoteState.buffer.match(/\n/g) || // linebreaks are too complex
matches?.length > 1 || // duplicates are too complex matches?.length > 1 // duplicates are too complex
non_ascii_regex.test(quoteState.buffer) // non-ascii chars break fast-edit
) { ) {
this.set("_isFastEditable", false); this.set("_isFastEditable", false);
this.set("_fastEditInitialSelection", null); this.set("_fastEditInitialSelection", null);

View File

@ -73,17 +73,4 @@ acceptance("Fast Edit", function (needs) {
assert.notOk(exists("#fast-edit-input"), "fast editor is not open"); assert.notOk(exists("#fast-edit-input"), "fast editor is not open");
assert.ok(exists(".d-editor-input"), "the composer is open"); assert.ok(exists(".d-editor-input"), "the composer is open");
}); });
test("Opens full composer when editing non-ascii characters", async function (assert) {
await visit("/t/internationalization-localization/280");
query("#post_2 .cooked").childNodes[0].innerHTML += `Dont ”say doesnt”`;
const textNode = query("#post_2 .cooked");
await selectText(textNode);
await click(".quote-button .quote-edit-label");
assert.notOk(exists("#fast-edit-input"), "fast editor is not open");
assert.ok(exists(".d-editor-input"), "the composer is open");
});
}); });