A platform for community discussion. Free, open, simple.
DEV: Add outlet and changes to support AI proofread (#24909)
Keegan George46eec957199f
diff --git a/app/assets/javascripts/discourse/app/components/fast-edit.gjs b/app/assets/javascripts/discourse/app/components/fast-edit.gjsindex d58b17ae3f3..ff2fb75715d 100644--- a/app/assets/javascripts/discourse/app/components/fast-edit.gjs+++ b/app/assets/javascripts/discourse/app/components/fast-edit.gjs@@ -1,8 +1,10 @@import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";+import { hash } from "@ember/helper";import { on } from "@ember/modifier";import { action } from "@ember/object";import DButton from "discourse/components/d-button";+import PluginOutlet from "discourse/components/plugin-outlet";import { fixQuotes } from "discourse/components/post-text-selection";import { ajax } from "discourse/lib/ajax";import { popupAjaxError } from "discourse/lib/ajax-error";@@ -11,8 +13,8 @@ import autoFocus from "discourse/modifiers/auto-focus";import I18n from "discourse-i18n";export default class FastEdit extends Component {- @tracked value = this.args.initialValue;@tracked isSaving = false;+ @tracked value = this.args.newValue || this.args.initialValue;buttonTitle = I18n.t("composer.title", {modifier: translateModKey("Meta+"),@@ -39,6 +41,11 @@ export default class FastEdit extends Component {this.value = event.target.value;}+ @action+ updateValueProperty(value) {+ this.value = value;+ }+@actionasync save() {this.isSaving = true;@@ -67,17 +74,29 @@ export default class FastEdit extends Component {{{on "input" this.updateValue}}id="fast-edit-input"{{autoFocus}}- >{{@initialValue}}</textarea>+ >{{this.value}}</textarea>++ <div class="fast-edit-container__footer">+ <DButton+ class="btn-small btn-primary save-fast-edit"+ @action={{this.save}}+ @icon="pencil-alt"+ @label="composer.save_edit"+ @translatedTitle={{this.buttonTitle}}+ @isLoading={{this.isSaving}}+ @disabled={{this.disabled}}+ />- <DButton- class="btn-small btn-primary save-fast-edit"- @action={{this.save}}- @icon="pencil-alt"- @label="composer.save_edit"- @translatedTitle={{this.buttonTitle}}- @isLoading={{this.isSaving}}- @disabled={{this.disabled}}- />+ <PluginOutlet+ @name="fast-edit-footer-after"+ @defaultGlimmer={{true}}+ @outletArgs={{hash+ initialValue=@initialValue+ newValue=@newValue+ updateValue=this.updateValueProperty+ }}+ />+ </div></div></template>}diff --git a/app/assets/javascripts/discourse/app/components/modal/fast-edit.hbs b/app/assets/javascripts/discourse/app/components/modal/fast-edit.hbsindex 692b336201b..ba9dd604802 100644--- a/app/assets/javascripts/discourse/app/components/modal/fast-edit.hbs+++ b/app/assets/javascripts/discourse/app/components/modal/fast-edit.hbs@@ -1,5 +1,6 @@<DModal @title={{i18n "post.quote_edit"}} @closeModal={{@closeModal}}><FastEdit+ @newValue={{@model.newValue}}@initialValue={{@model.initialValue}}@post={{@model.post}}@close={{@closeModal}}diff --git a/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs b/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjsindex e0e0c56bc91..372a724e993 100644--- a/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs+++ b/app/assets/javascripts/discourse/app/components/post-text-selection-toolbar.gjs@@ -190,7 +190,7 @@ export default class PostTextSelectionToolbar extends Component {<PluginOutlet@name="post-text-buttons"@defaultGlimmer={{true}}- @outletArgs={{hash data=@data}}+ @outletArgs={{hash data=@data post=this.post}}>{{#if this.embedQuoteButton}}<DButton