From 11da4d0d813434271c124ea9d61ba8be5b7ecc29 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 1 Oct 2025 12:12:14 +0300 Subject: [PATCH] create post edit view change --- client/res/templates/stream/record/edit.tpl | 58 +++++++++---------- client/src/views/stream/modals/create-post.js | 4 +- client/src/views/stream/record/edit.js | 47 --------------- 3 files changed, 29 insertions(+), 80 deletions(-) diff --git a/client/res/templates/stream/record/edit.tpl b/client/res/templates/stream/record/edit.tpl index 18ffcd1a4e..05c5bce500 100644 --- a/client/res/templates/stream/record/edit.tpl +++ b/client/res/templates/stream/record/edit.tpl @@ -1,38 +1,32 @@ -
-
-
{{{postField}}}
-
-
-
-
-
- {{#if interactiveMode}} -
- -
- {{/if}} -
-
{{{attachmentsField}}}
+
+
+
+
+
{{{postField}}}
-
-
-
-
- -
{{{targetTypeField}}}
+
+
+
+
+
{{{attachmentsField}}}
+
+
-
-
{{{usersField}}}
-
-
-
{{{teamsField}}}
-
-
-
{{{portalsField}}}
+
+
+ +
{{{targetTypeField}}}
+
+
+
{{{usersField}}}
+
+
+
{{{teamsField}}}
+
+
+
{{{portalsField}}}
+
diff --git a/client/src/views/stream/modals/create-post.js b/client/src/views/stream/modals/create-post.js index 7cfe19e763..c7104c1d74 100644 --- a/client/src/views/stream/modals/create-post.js +++ b/client/src/views/stream/modals/create-post.js @@ -30,7 +30,9 @@ import ModalView from 'views/modal'; class CreatePostModalView extends ModalView { - templateContent = '
{{{record}}}
' + templateContent = ` +
{{{record}}}
+ ` shortcutKeys = { 'Control+Enter': 'post', diff --git a/client/src/views/stream/record/edit.js b/client/src/views/stream/record/edit.js index 77ec601822..7fbf4459e7 100644 --- a/client/src/views/stream/record/edit.js +++ b/client/src/views/stream/record/edit.js @@ -105,47 +105,11 @@ class EditStreamView extends BaseRecordView { } } - data() { - const data = super.data(); - - data.interactiveMode = this.options.interactiveMode; - - return data; - } - setup() { super.setup(); this.seed = this.model.clone(); - if (this.options.interactiveMode) { - this.events['focus textarea[data-name="post"]'] = () => { - this.enablePostingMode(); - }; - - this.addHandler('keydown', 'textarea[data-name="post"]', /** KeyboardEvent */e => { - if (Espo.Utils.getKeyFromKeyEvent(e) === 'Control+Enter') { - e.stopPropagation(); - e.preventDefault(); - - this.post(); - } - - // Don't hide to be able to focus on the upload button. - /*if (e.code === 'Tab') { - let $text = $(e.currentTarget); - - if ($text.val() === '') { - this.disablePostingMode(); - } - }*/ - }); - - this.events['click button.post'] = () => { - this.post(); - }; - } - const optionList = ['self']; this.model.set('type', 'Post'); @@ -280,17 +244,6 @@ class EditStreamView extends BaseRecordView { afterSave() { Espo.Ui.success(this.translate('Posted')); - - if (this.options.interactiveMode) { - this.model.clear(); - this.model.set('targetType', 'self'); - this.model.set('type', 'Post'); - - this.disablePostingMode(); - this.enablePostButton(); - - this.getFieldView('post').$element.prop('rows', 1); - } } afterNotValid() {