Skip to content

Commit ca332f4

Browse files
committed
feat: Implement textfield in editor for messages view new convo and reply mode
1 parent 0c355ef commit ca332f4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/components/layout/Editor.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@
157157

158158
<div class="editor-body" @dragenter.prevent="showDropzone = true" @dragover.prevent="showDropzone = true">
159159
<div class="editor-column-input" :class="{ 'hidden': preview }">
160-
<textarea class="editor-input" v-if="threadEditorMode" v-model="threadCopy.body" :class="{ 'rtl': rtl }" placeholder="Enter your reply here. (BTW, you can drag and drop images directly into the editor panel)" :maxlength="postMaxLength || 10000"></textarea>
160+
<textarea class="editor-input" v-if="threadEditorMode" v-model="threadCopy.body" :class="{ 'rtl': rtl }" placeholder="Write someting interesting! (BTW, you can drag and drop images directly into the editor panel)" :maxlength="postMaxLength || 10000"></textarea>
161161
<textarea class="editor-input" v-if="postEditorMode" v-model="posting.post.body" :class="{ 'rtl': rtl }" placeholder="Enter your reply here. (BTW, you can drag and drop images directly into the editor panel)" :maxlength="postMaxLength || 10000"></textarea>
162+
<textarea class="editor-input" v-if="editorConvoMode || (!threadEditorMode && !editorConvoMode && !postEditorMode)" v-model="newMessage.content.body" :class="{ 'rtl': rtl }" :placeholder="editorConvoMode ? 'Enter your message here. (BTW, you can drag and drop images directly into the editor panel)' : 'Enter your reply here. (BTW, you can drag and drop images directly into the editor panel)'" :maxlength="postMaxLength || 10000"></textarea>
162163
<div class="editor-drag-container" :class="{ 'visible': showDropzone}">
163164
<div class="editor-drag">
164165
<div class="editor-drag-text">Drag and Drop Images</div>
@@ -191,10 +192,10 @@
191192
<button class="inverted-button cancel" @click="cancel()">
192193
Cancel
193194
</button>
194-
<button class="no-animate send" v-if="editorConvoMode" @click="createAction().then(closeEditor);" :disabled="!canCreate() || !newMessage.content.body.length || !newMessage.content.subject.length || !receivers.length">
195+
<button class="no-animate send" v-if="editorConvoMode" @click.prevent="createAction().then(closeEditor);" :disabled="!canCreate() || !newMessage.content.body.length || !newMessage.content.subject.length || !receivers.length">
195196
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Send
196197
</button>
197-
<button class="no-animate send" v-if="!editorConvoMode" @click="updateAction().then(closeEditor);" :disabled="!canUpdate() || !newMessage.content.body.length">
198+
<button class="no-animate send" v-if="!editorConvoMode" @click.prevent="updateAction().then(closeEditor);" :disabled="!canUpdate() || !newMessage.content.body.length">
198199
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Send Reply
199200
</button>
200201

@@ -206,7 +207,7 @@
206207
<button class="inverted-button cancel" @click="cancel()">
207208
Cancel
208209
</button>
209-
<button class="send" @click="createAction(posting.post).then(closeEditor);" :disabled="!canCreate()">
210+
<button class="send" @click.prevent="createAction(posting.post).then(closeEditor);" :disabled="!canCreate()">
210211
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;{{ posting?.post?.id ? 'Edit Post' : 'Send Reply' }}
211212
</button>
212213

@@ -218,7 +219,7 @@
218219
<button class="inverted-button cancel" @click="cancel()">
219220
Cancel
220221
</button>
221-
<button class="send" @click="createAction(threadCopy).then(closeEditor);" @disabled="!threadCopy?.title.length || !canCreate() || (threadCopy.addPoll && !threadCopy.pollValid)">
222+
<button class="send" @click.prevent="createAction(threadCopy).then(closeEditor);" @disabled="!threadCopy?.title.length || !canCreate() || (threadCopy.addPoll && !threadCopy.pollValid)">
222223
<i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;Start Thread
223224
</button>
224225

@@ -241,6 +242,7 @@ export default {
241242
setup(props, { emit }) {
242243
243244
const canCreate = () => true
245+
const canUpdate = () => true
244246
const canLock = () => true
245247
const canSticky = () => true
246248
const canModerate = () => true
@@ -274,7 +276,7 @@ export default {
274276
v.posting.post.title = t.title
275277
})
276278
277-
return { ...toRefs(v), canLock, canCreate, canSticky, canModerate, canCreatePoll, cancel, closeEditor }
279+
return { ...toRefs(v), canLock, canCreate, canUpdate, canSticky, canModerate, canCreatePoll, cancel, closeEditor }
278280
}
279281
}
280282
</script>

src/views/Messages.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<delete-conversation-modal :show="showDeleteConversationModal" :conversation-id="selectedDeletedConvoId" @close="showDeleteConversationModal = false" @success="reload()" />
149149
<delete-message-modal :show="showDeleteMessageModal" :message-id="selectedMessageId" @close="showDeleteMessageModal = false" @success="deleteMessageSuccess()" />
150150
<report-message-modal :show="showReportMessageModal" :message-id="selectedMessageId" @close="showReportMessageModal = false" @success="showReportMessageModal = false" />
151-
<editor :showEditor="showEditor" @close="showEditor = false" editorConvoMode="true" />
151+
<editor :showEditor="showEditor" @close="showEditor = false" :editorConvoMode="editorConvoMode" />
152152
</template>
153153

154154
<script>

0 commit comments

Comments
 (0)