DEV: Disable smart lists for now on Firefox (#27677)

Firefox is having a lot of inconsistent issues with this
feature introduced in 30fdd7738e,
disabling it there for now until further investigation can
be done.
This commit is contained in:
Martin Brennan 2024-07-02 13:36:24 +10:00 committed by GitHub
parent a1d2c46d28
commit 2ab4913d13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 8 deletions

View File

@ -515,6 +515,15 @@ export default Mixin.create({
@bind
maybeContinueList() {
// TODO (martin) Very inconsistent on Firefox at the moment, we end up with
// things like this. Something about newlines maybe?
//
// 1. a
// 2. test? 2. 2. 2. 2. 2.
if (this.capabilities.isFirefox) {
return false;
}
const offset = caretPosition(this._textarea);
const text = this._textarea.value;
const lines = text.substring(0, offset).split("\n");

View File

@ -14,6 +14,7 @@ import { setCaretPosition } from "discourse/lib/utilities";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";
import {
chromeTest,
exists,
paste,
query,
@ -77,8 +78,13 @@ module("Integration | Component | d-editor", function (hooks) {
return textarea;
}
function testCase(title, testFunc) {
test(title, async function (assert) {
function testCase(title, testFunc, opts = {}) {
let testFn = test;
if (opts.chrome) {
testFn = chromeTest;
}
testFn(title, async function (assert) {
this.set("value", "hello world.");
await render(hbs`<DEditor @value={{this.value}} />`);
@ -991,7 +997,8 @@ third line`
setCaretPosition(textarea, initialValue.length);
await triggerKeyEvent(textarea, "keydown", "Enter");
assert.strictEqual(this.value, initialValue + "* ");
}
},
{ chrome: true }
);
testCase(
@ -1002,7 +1009,8 @@ third line`
setCaretPosition(textarea, initialValue.length);
await triggerKeyEvent(textarea, "keydown", "Enter");
assert.strictEqual(this.value, initialValue + "- ");
}
},
{ chrome: true }
);
testCase(
@ -1013,7 +1021,8 @@ third line`
setCaretPosition(textarea, initialValue.length);
await triggerKeyEvent(textarea, "keydown", "Enter");
assert.strictEqual(this.value, initialValue + "2. ");
}
},
{ chrome: true }
);
testCase(
@ -1027,7 +1036,8 @@ third line`
this.value,
"* first item in list\n* \n* second item in list"
);
}
},
{ chrome: true }
);
testCase(
@ -1041,7 +1051,8 @@ third line`
this.value,
"1. first item in list\n2. \n3. second item in list"
);
}
},
{ chrome: true }
);
testCase(
@ -1052,7 +1063,8 @@ third line`
setCaretPosition(textarea, initialValue.length);
await triggerKeyEvent(textarea, "keydown", "Enter");
assert.strictEqual(this.value, "* first item in list with empty line\n");
}
},
{ chrome: true }
);
(() => {