CLASSROOMIO-T-128: TinyMCE Editor Test

CLASSROOMIO-T-128: TinyMCE Integration

Merge branch 'main' into CLASSROOMIO-T-128

CLASSROOMIO-T-128: Resolved Fixes

CLASSROOMIO-T-128: Ts Errors

CLASSROOMIO-T-128: Resolved Feedbacks

CLASSROOMIO-T-128: Replace Quill with tinyMCE

CLASSROOMIO-T-128: Compare Editors

CLASSROOMIO-T-128: TinyMCE Editor Test


Co-authored-by: Rotimi Best <rotimiibitoyeemma@gmail.com>
Co-authored-by: Tunji Adeyemi <tunji@digdippa.com>


Merge-request: CLASSROOMIO-MR-62
Merged-by: Best Admin <best@digdippa.com>
This commit is contained in:
tunny17
2023-09-05 13:21:44 +00:00
committed by Space Cloud
co-authored by Rotimi Best
parent 0200bc46ac
commit 75479e9719
14 changed files with 168 additions and 1206 deletions
+15 -13
View File
@@ -10,7 +10,6 @@
import Vote from '$lib/components/Vote/index.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import TextEditor from '$lib/components/TextEditor/index.svelte';
import Avatar from '$lib/components/Avatar/index.svelte';
import IconButton from '$lib/components/IconButton/index.svelte';
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
@@ -25,6 +24,7 @@
import { snackbarStore } from '$lib/components/Snackbar/store';
import TextField from '$lib/components/Form/TextField.svelte';
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte';
dayjs.extend(relativeTime);
@@ -47,6 +47,8 @@
body: ''
};
let editorInstance = false;
function mapResToQuestion(data) {
return {
id: data.id,
@@ -211,6 +213,7 @@
}
isEditMode = !isEditMode;
editorInstance = !editorInstance;
if (!isEditMode) {
const fields = { title: editContent.title, body: editContent.body };
@@ -334,14 +337,12 @@
</p>
</div>
</header>
{#if isEditMode}
{#if isEditMode && editorInstance}
<div class="my-2">
<TextEditor
content={question.body}
onChange={(c) => (editContent.body = c)}
placeholder="Update question"
errorMessage={errors.body}
docId={resetInput}
bind:value={editContent.body}
placeholder="Give an answer"
onChange={(html) => (editContent.body = html)}
/>
</div>
{:else}
@@ -398,12 +399,13 @@
<hr />
<div>
<TextEditor
onChange={(c) => (comment = c)}
placeholder="Give an answer"
errorMessage={errors.comment}
docId={resetInput}
/>
{#if !editorInstance}
<TextEditor
bind:value={comment}
placeholder="Give an answer"
onChange={(html) => (comment = html)}
/>
{/if}
<div class="flex justify-end mr-2">
<PrimaryButton label="Comment" onClick={submitComment} />
+3 -3
View File
@@ -1,7 +1,6 @@
<script>
import { goto } from '$app/navigation';
import ArrowLeftIcon from 'carbon-icons-svelte/lib/ArrowLeft.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte';
import { currentOrg } from '$lib/utils/store/org';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { askCommunityValidation } from '$lib/utils/functions/validator';
@@ -9,6 +8,7 @@
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { snackbarStore } from '$lib/components/Snackbar/store';
import generateSlug from '$lib/utils/functions/generateSlug';
import TextEditor from '$lib/components/TextEditor/index.svelte';
let errors = {};
let fields = {
@@ -87,8 +87,8 @@
</div>
<TextEditor
onChange={(v) => (fields.body = v)}
bind:value={fields.body}
placeholder="Ask the community any question you might have"
errorMessage={errors.body}
onChange={(html) => (fields.body = html)}
/>
</section>
@@ -9,7 +9,6 @@
import Vote from '$lib/components/Vote/index.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import TextEditor from '$lib/components/TextEditor/index.svelte';
import Avatar from '$lib/components/Avatar/index.svelte';
import IconButton from '$lib/components/IconButton/index.svelte';
import CheckmarkOutlineIcon from 'carbon-icons-svelte/lib/CheckmarkOutline.svelte';
@@ -24,6 +23,7 @@
import { snackbarStore } from '$lib/components/Snackbar/store';
import TextField from '$lib/components/Form/TextField.svelte';
import DeleteCommentModal from '$lib/components/Org/Community/DeleteCommentModal.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte';
dayjs.extend(relativeTime);
@@ -46,6 +46,8 @@
body: ''
};
let editorInstance = false;
function mapResToQuestion(data) {
return {
id: data.id,
@@ -210,6 +212,7 @@
}
isEditMode = !isEditMode;
editorInstance = !editorInstance;
if (!isEditMode) {
const fields = { title: editContent.title, body: editContent.body };
@@ -336,14 +339,12 @@
</p>
</div>
</header>
{#if isEditMode}
{#if isEditMode && editorInstance}
<div class="my-2">
<TextEditor
content={question.body}
onChange={(c) => (editContent.body = c)}
placeholder="Update question"
errorMessage={errors.body}
docId={resetInput}
bind:value={editContent.body}
placeholder="Give an answer"
onChange={(html) => (editContent.body = html)}
/>
</div>
{:else}
@@ -400,12 +401,13 @@
<hr />
<div>
<TextEditor
onChange={(c) => (comment = c)}
placeholder="Give an answer"
errorMessage={errors.comment}
docId={resetInput}
/>
{#if !editorInstance}
<TextEditor
bind:value={comment}
placeholder="Give an answer"
onChange={(html) => (comment = html)}
/>
{/if}
<div class="flex justify-end mr-2">
<PrimaryButton label="Comment" onClick={submitComment} />
@@ -1,7 +1,6 @@
<script>
import { goto } from '$app/navigation';
import ArrowLeftIcon from 'carbon-icons-svelte/lib/ArrowLeft.svelte';
import TextEditor from '$lib/components/TextEditor/index.svelte';
import { currentOrgPath, currentOrg } from '$lib/utils/store/org';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { askCommunityValidation } from '$lib/utils/functions/validator';
@@ -9,6 +8,7 @@
import { SNACKBAR_SEVERITY } from '$lib/components/Snackbar/constants';
import { snackbarStore } from '$lib/components/Snackbar/store';
import generateSlug from '$lib/utils/functions/generateSlug';
import TextEditor from '$lib/components/TextEditor/index.svelte';
let errors = {};
let fields = {
@@ -90,8 +90,8 @@
</div>
<TextEditor
onChange={(v) => (fields.body = v)}
bind:value={fields.body}
placeholder="Ask the community any question you might have"
errorMessage={errors.body}
onChange={(html) => (fields.body = html)}
/>
</section>