Skip to content

Commit 0e686ba

Browse files
committed
Revert Trix.config.editor changes
1 parent 5806006 commit 0e686ba

File tree

8 files changed

+18
-38
lines changed

8 files changed

+18
-38
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
name: "Browser tests (Trix.config.editor.formAssociated = ${{ matrix.formAssociated }})"
12-
strategy:
13-
matrix:
14-
formAssociated: [true, false]
15-
env:
16-
FORM_ASSOCIATED: "${{ matrix.formAssociated }}"
11+
name: Browser tests
1712
runs-on: ubuntu-latest
1813
steps:
1914
- uses: actions/checkout@v3

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ Clicking the quote button toggles whether the block should be rendered with `<bl
9090

9191
## Integrating with Element Internals
9292

93-
Trix will integrate `<trix-editor>` elements with forms depending on the browser's support for [Element Internals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals). By default, Trix will enable support for `ElementInternals` when the feature is enabled in the browser. If there is a need to disable support for `ElementInternals`, set `Trix.config.editor.formAssociated = false`:
93+
Trix will integrate `<trix-editor>` elements with forms depending on the browser's support for [Element Internals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals). If there is a need to disable support for `ElementInternals`, set `Trix.elements.TrixEditorElement.formAssociated = false`:
9494

9595
```js
9696
import Trix from "trix"
9797

98-
Trix.config.editor.formAssociated = false
98+
Trix.elements.TrixEditorElement.formAssociated = false
9999
```
100100

101101
## Invoking Internal Trix Actions

karma.conf.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const config = {
33
frameworks: [ "qunit" ],
44
files: [
55
{ pattern: "dist/test.js", watched: false },
6-
{ pattern: "src/test/test_helpers/fixtures/*.png", watched: false, included: false, served: true }
6+
{ pattern: "src/test_helpers/fixtures/*.png", watched: false, included: false, served: true }
77
],
88
proxies: {
99
"/test_helpers/fixtures/": "/base/src/test_helpers/fixtures/"
@@ -29,14 +29,6 @@ const config = {
2929

3030
/* eslint camelcase: "off", */
3131

32-
if (process.env.FORM_ASSOCIATED === "false") {
33-
config.files.push({
34-
pattern: "src/test/test_helpers/fixtures/form_associated_false.js",
35-
watched: false,
36-
included: true
37-
})
38-
}
39-
4032
if (process.env.SAUCE_ACCESS_KEY) {
4133
config.customLaunchers = {
4234
sl_chrome_latest: {

src/test/system/custom_element_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as config from "trix/config"
21
import { rangesAreEqual } from "trix/core/helpers"
2+
import TrixEditorElement from "trix/elements/trix_editor_element"
33

44
import {
55
TEST_IMAGE_URL,
@@ -690,10 +690,10 @@ testGroup("form property references its <form>", { template: "editors_with_forms
690690

691691
function testIfFormAssociated(name, callback) {
692692
test(name, async () => {
693-
if (config.editor.formAssociated) {
693+
if (TrixEditorElement.formAssociated) {
694694
await callback()
695695
} else {
696-
assert.equal(config.editor.formAssociated, false, "skipping test that requires ElementInternals")
696+
assert.equal(TrixEditorElement.formAssociated, false, "skipping test that requires ElementInternals")
697697
}
698698
})
699699
}

src/test/test_helpers/fixtures/form_associated_false.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/trix/config/editor.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/trix/config/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export { default as attachments } from "./attachments"
22
export { default as blockAttributes } from "./block_attributes"
33
export { default as browser } from "./browser"
44
export { default as css } from "./css"
5-
export { default as editor } from "./editor"
65
export { default as fileSize } from "./file_size_formatting"
76
export { default as input } from "./input"
87
export { default as keyNames } from "./key_names"

src/trix/elements/trix_editor_element.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ installDefaultCSSForTagName("trix-editor", `\
161161
}`)
162162

163163
export default class TrixEditorElement extends HTMLElement {
164-
static get formAssociated() {
165-
return config.editor.formAssociated
166-
}
164+
static formAssociated = "ElementInternals" in window
167165

168166
#customValidationMessage
169167
#internals
@@ -261,7 +259,7 @@ export default class TrixEditorElement extends HTMLElement {
261259
if (this.#internals) {
262260
return this.inputElement.disabled
263261
} else {
264-
console.warn("Trix is not configured to support the [disabled] attribute. Set Trix.config.editor.formAssociated = true")
262+
console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")
265263

266264
return false
267265
}
@@ -271,15 +269,15 @@ export default class TrixEditorElement extends HTMLElement {
271269
if (this.#internals) {
272270
this.toggleAttribute("disabled", value)
273271
} else {
274-
console.warn("Trix is not configured to support the [disabled] attribute. Set Trix.config.editor.formAssociated = true")
272+
console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")
275273
}
276274
}
277275

278276
get required() {
279277
if (this.#internals) {
280278
return this.hasAttribute("required")
281279
} else {
282-
console.warn("Trix is not configured to support the [required] attribute. Set Trix.config.editor.formAssociated = true")
280+
console.warn("This browser does not support the [required] attribute for trix-editor elements.")
283281

284282
return false
285283
}
@@ -290,15 +288,15 @@ export default class TrixEditorElement extends HTMLElement {
290288
this.toggleAttribute("required", value)
291289
this.#synchronizeValidation()
292290
} else {
293-
console.warn("Trix is not configured to support the [required] attribute. Set Trix.config.editor.formAssociated = true")
291+
console.warn("This browser does not support the [required] attribute for trix-editor elements.")
294292
}
295293
}
296294

297295
get validity() {
298296
if (this.#internals) {
299297
return this.#internals.validity
300298
} else {
301-
console.warn("Trix is not configured to support the validity property. Set Trix.config.editor.formAssociated = true")
299+
console.warn("This browser does not support the validity property for trix-editor elements.")
302300
return null
303301
}
304302
}
@@ -307,7 +305,7 @@ export default class TrixEditorElement extends HTMLElement {
307305
if (this.#internals) {
308306
return this.#internals.validationMessage
309307
} else {
310-
console.warn("Trix is not configured to support the validationMessage property. Set Trix.config.editor.formAssociated = true")
308+
console.warn("This browser does not support the validationMessage property for trix-editor elements.")
311309

312310
return ""
313311
}
@@ -317,7 +315,7 @@ export default class TrixEditorElement extends HTMLElement {
317315
if (this.#internals) {
318316
return this.#internals.willValidate
319317
} else {
320-
console.warn("Trix is not configured to support the willValidate property. Set Trix.config.editor.formAssociated = true")
318+
console.warn("This browser does not support the willValidate property for trix-editor elements.")
321319

322320
return false
323321
}
@@ -425,7 +423,7 @@ export default class TrixEditorElement extends HTMLElement {
425423
if (this.#internals) {
426424
return this.#internals.checkValidity()
427425
} else {
428-
console.warn("Trix is not configured to support checkValidity(). Set Trix.config.editor.formAssociated = true")
426+
console.warn("This browser does not support checkValidity() for trix-editor elements.")
429427

430428
return true
431429
}
@@ -435,7 +433,7 @@ export default class TrixEditorElement extends HTMLElement {
435433
if (this.#internals) {
436434
return this.#internals.reportValidity()
437435
} else {
438-
console.warn("Trix is not configured to support reportValidity(). Set Trix.config.editor.formAssociated = true")
436+
console.warn("This browser does not support reportValidity() for trix-editor elements.")
439437

440438
return true
441439
}
@@ -447,7 +445,7 @@ export default class TrixEditorElement extends HTMLElement {
447445

448446
this.#synchronizeValidation()
449447
} else {
450-
console.warn("Trix is not configured to support setCustomValidity(validationMessage). Set Trix.config.editor.formAssociated = true")
448+
console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")
451449
}
452450
}
453451

0 commit comments

Comments
 (0)