Skip to content

Commit 835d7d5

Browse files
committed
Fix stale app/assets/javascripts/trix.js file
The changes proposed to `action_text-trix/app/assets/javascripts/trix.js` were generated by executing the following: ```sh yarn build ``` To reduce the risk of future commits' outputs being excluded from the commits that introduce them, this commit introduces some `git` commands to the `.github/workflows/ci.yml` file to fail CI builds when `yarn build` creates changes that are not already checked into the git commit. The commands are lifted directly from the [hotwired/turbo-rails][] version of this file. [hotwired/turbo-rails]: https://github.com/hotwired/turbo-rails/blob/v2.0.20/.github/workflows/ci.yml#L48-L51
1 parent 3a09fb9 commit 835d7d5

File tree

2 files changed

+33
-2
lines changed
  • .github/workflows
  • action_text-trix/app/assets/javascripts

2 files changed

+33
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
- name: Install Dependencies
2525
run: yarn install --frozen-lockfile
2626
- run: bin/ci
27+
- name: Fail when generated npm changes are not checked-in
28+
run: |
29+
git update-index --refresh && git diff-index --quiet HEAD --
30+
2731
rails-tests:
2832
name: Downstream Rails integration tests
2933
runs-on: ubuntu-latest

action_text-trix/app/assets/javascripts/trix.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,12 +3451,16 @@ $\
34513451
}
34523452
const width = this.attachment.getWidth();
34533453
const height = this.attachment.getHeight();
3454+
const alt = this.attachment.getAttribute("alt");
34543455
if (width != null) {
34553456
image.width = width;
34563457
}
34573458
if (height != null) {
34583459
image.height = height;
34593460
}
3461+
if (alt != null) {
3462+
image.alt = alt;
3463+
}
34603464
const storeKey = ["imageElement", this.attachment.id, image.src, image.width, image.height].join("/");
34613465
image.dataset.trixStoreKey = storeKey;
34623466
}
@@ -6616,6 +6620,11 @@ $\
66166620
this.attributes = Hash.box(attributes);
66176621
this.didChangeAttributes();
66186622
}
6623+
setAttribute(attribute, value) {
6624+
this.setAttributes({
6625+
[attribute]: value
6626+
});
6627+
}
66196628
getAttribute(attribute) {
66206629
return this.attributes.get(attribute);
66216630
}
@@ -8855,6 +8864,8 @@ $\
88558864
ManagedAttachment.proxyMethod("attachment.isPending");
88568865
ManagedAttachment.proxyMethod("attachment.isPreviewable");
88578866
ManagedAttachment.proxyMethod("attachment.getURL");
8867+
ManagedAttachment.proxyMethod("attachment.getPreviewURL");
8868+
ManagedAttachment.proxyMethod("attachment.setPreviewURL");
88588869
ManagedAttachment.proxyMethod("attachment.getHref");
88598870
ManagedAttachment.proxyMethod("attachment.getFilename");
88608871
ManagedAttachment.proxyMethod("attachment.getFilesize");
@@ -12465,12 +12476,12 @@ $\
1246512476
this.attributes = {};
1246612477
this.actions = {};
1246712478
this.resetDialogInputs();
12468-
handleEvent("mousedown", {
12479+
handleEvent("click", {
1246912480
onElement: this.element,
1247012481
matchingSelector: actionButtonSelector,
1247112482
withCallback: this.didClickActionButton
1247212483
});
12473-
handleEvent("mousedown", {
12484+
handleEvent("click", {
1247412485
onElement: this.element,
1247512486
matchingSelector: attributeButtonSelector,
1247612487
withCallback: this.didClickAttributeButton
@@ -13248,6 +13259,22 @@ $\
1324813259
this.innerHTML = toolbar.getDefaultHTML();
1324913260
}
1325013261
}
13262+
13263+
// Properties
13264+
13265+
get editorElements() {
13266+
if (this.id) {
13267+
var _this$ownerDocument;
13268+
const nodeList = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.querySelectorAll("trix-editor[toolbar=\"".concat(this.id, "\"]"));
13269+
return Array.from(nodeList);
13270+
} else {
13271+
return [];
13272+
}
13273+
}
13274+
get editorElement() {
13275+
const [editorElement] = this.editorElements;
13276+
return editorElement;
13277+
}
1325113278
}
1325213279

1325313280
let id = 0;

0 commit comments

Comments
 (0)