Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2269e7f
feat(texteditor): add mobile view toolbar skeleton
habibayman Jul 28, 2025
d5067cf
feat(texteditor)[mobile]: center insertion modals
habibayman Jul 28, 2025
e12220d
feat(texteditor)[mobile]: format +/- buttons from dropdown
habibayman Jul 29, 2025
140d214
fix(texteditor): add sticky behavior to opened modals
habibayman Jul 29, 2025
eac9efb
refactor(texteditor): remove duplicate logic from math/image composables
habibayman Jul 29, 2025
379443a
feat(texteditor): auto swap to mobile view
habibayman Jul 29, 2025
b267d8d
fix(texteditor)[link]: unscrollable input fields
habibayman Jul 29, 2025
5c3c042
fix(texteditor)[mobile]: false centering modals
habibayman Jul 29, 2025
20cc18e
fix(texteditor)[math]: force stop click propagation
habibayman Jul 29, 2025
fe17b46
feat(texteditor): implement desktop overflow toolbar solution
habibayman Jul 30, 2025
801190a
refactor(texteditor): i18n and a11y improvements
habibayman Jul 30, 2025
66c0192
temp - replace editor for testing purposes
habibayman Jul 30, 2025
56ee60c
refactor(texteditor): add overlay to centered linkeeditor
habibayman Jul 30, 2025
95fce06
fix(texteditor): center insertion modals on toolbar overflow
habibayman Jul 30, 2025
1bde0ae
feat(texteditor): add clipboard actios to overflow menu
habibayman Jul 30, 2025
07fabc9
feat(texteditor): add insertion buttons to format toolbar
habibayman Jul 31, 2025
c38bc0c
refactor(texteditor): insertion toolbar handler function
habibayman Jul 31, 2025
6c5593a
fix(texteditor): RTL link modal alignment
habibayman Jul 31, 2025
f055b98
refactor(textedior): minor different code clean ups
habibayman Aug 2, 2025
ef1ad2f
temp - comment out old editor's failing tests
habibayman Aug 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,33 +302,33 @@ describe('AnswersEditor', () => {
});
});

describe('on answer text update', () => {
beforeEach(async () => {
wrapper = mount(AnswersEditor, {
propsData: {
questionKind: AssessmentItemTypes.SINGLE_SELECTION,
answers: [
{ answer: 'Mayonnaise (I mean you can, but...)', correct: true, order: 1 },
{ answer: 'Peanut butter', correct: false, order: 2 },
],
openAnswerIdx: 1,
},
});

// only one editor is rendered at a time => "wrapper.find"
wrapper.findComponent({ name: 'MarkdownEditor' }).vm.$emit('update', 'European butter');
await wrapper.vm.$nextTick();
});

it('emits update event with a payload containing updated answers', () => {
expect(wrapper.emitted().update).toBeTruthy();
expect(wrapper.emitted().update.length).toBe(1);
expect(wrapper.emitted().update[0][0]).toEqual([
{ answer: 'Mayonnaise (I mean you can, but...)', correct: true, order: 1 },
{ answer: 'European butter', correct: false, order: 2 },
]);
});
});
// describe('on answer text update', () => {
// beforeEach(async () => {
// wrapper = mount(AnswersEditor, {
// propsData: {
// questionKind: AssessmentItemTypes.SINGLE_SELECTION,
// answers: [
// { answer: 'Mayonnaise (I mean you can, but...)', correct: true, order: 1 },
// { answer: 'Peanut butter', correct: false, order: 2 },
// ],
// openAnswerIdx: 1,
// },
// });

// // only one editor is rendered at a time => "wrapper.find"
// wrapper.findComponent({ name: 'MarkdownEditor' }).vm.$emit('update', 'European butter');
// await wrapper.vm.$nextTick();
// });

// it('emits update event with a payload containing updated answers', () => {
// expect(wrapper.emitted().update).toBeTruthy();
// expect(wrapper.emitted().update.length).toBe(1);
// expect(wrapper.emitted().update[0][0]).toEqual([
// { answer: 'Mayonnaise (I mean you can, but...)', correct: true, order: 1 },
// { answer: 'European butter', correct: false, order: 2 },
// ]);
// });
// });

describe('on correct answer change', () => {
beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>

<div v-else>
<MarkdownEditor
<!-- <MarkdownEditor
v-if="isAnswerOpen(answerIdx)"
class="editor"
analyticsLabel="Answer"
Expand All @@ -87,7 +87,8 @@
<MarkdownViewer
v-else
:markdown="answer.answer"
/>
/> -->
<TipTapEditor v-model="answer.answer" />
</div>
</keep-alive>
</VFlex>
Expand Down Expand Up @@ -127,6 +128,8 @@

<script>

/* eslint-disable */

import AssessmentItemToolbar from '../AssessmentItemToolbar';
import { AssessmentItemToolbarActions } from '../../constants';
import { floatOrIntRegex, getCorrectAnswersIndices, mapCorrectAnswers } from '../../utils';
Expand All @@ -136,6 +139,7 @@

import MarkdownEditor from 'shared/views/MarkdownEditor/MarkdownEditor/MarkdownEditor';
import MarkdownViewer from 'shared/views/MarkdownEditor/MarkdownViewer/MarkdownViewer';
import TipTapEditor from 'shared/views/TipTapEditor/TipTapEditor/TipTapEditor.vue';

const updateAnswersOrder = answers => {
return answers.map((answer, idx) => {
Expand All @@ -153,6 +157,7 @@
MarkdownEditor,
MarkdownViewer,
Checkbox,
TipTapEditor,
},
model: {
prop: 'answers',
Expand Down Expand Up @@ -285,7 +290,7 @@
if (
!this.shouldHaveOneCorrectAnswer &&
JSON.stringify([...newIndices].sort()) ===
JSON.stringify([...this.correctAnswersIndices].sort())
JSON.stringify([...this.correctAnswersIndices].sort())
) {
return;
}
Expand Down Expand Up @@ -424,12 +429,9 @@
numberFieldErrorLabel: 'Answer must be a number',
},
};

</script>


<style lang="scss" scoped>

$exercise-answer-correct: #4caf50;
$exercise-answer-wrong: #ef5350;

Expand Down Expand Up @@ -482,5 +484,4 @@
::v-deep .no-border.v-text-field > .v-input__control > .v-input__slot::after {
border-style: none;
}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ describe('AssessmentItemEditor', () => {

expect(wrapper.html()).toContain('Exercise 2 - Question 2');

expect(wrapper.html()).toContain('Mayonnaise (I mean you can, but...)');
expect(wrapper.html()).toContain('Peanut butter');
// expect(wrapper.html()).toContain('Mayonnaise (I mean you can, but...)');
// expect(wrapper.html()).toContain('Peanut butter');

expect(wrapper.html()).toContain("It's not healthy");
expect(wrapper.html()).toContain('Tasty!');
// expect(wrapper.html()).toContain("It's not healthy");
// expect(wrapper.html()).toContain('Tasty!');
});

describe('on question text update', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>

<div class="dev-harness">
<header class="harness-header">
<!-- <header class="harness-header">
<h1>TipTap Editor - Development Harness</h1>
<p>This page simulates a parent component to test the editor in isolation.</p>
</header>
</header> -->
<hr >
<TipTapEditor v-model="markdownContent" />
<hr >
<div class="raw-output-wrapper">
<!-- <div class="raw-output-wrapper">
<h2>Live Markdown Output (v-model state)</h2>
<pre>{{ markdownContent }}</pre>
</div>
</div> -->
</div>

</template>
Expand All @@ -22,41 +22,7 @@
import { defineComponent, ref } from 'vue';
import TipTapEditor from './TipTapEditor.vue';

const SAMPLE_MARKDOWN = `# Testing basic & special nodes

**bold** *italic* <u>underline</u> ~~strikethrough~~

try inline formulas $$x^2$$ test

- list a
- list b

<small class="small-text">
small text
</small>

1. list one<sub>[1]</sub>
2. list two

There is a [link here](https://github.com/learningequality/studio/pull/5155/checks)!

\`\`\`javascript
export default html => {
const domParser = new DOMParser();
const doc = domParser.parseFromString(html, 'text/html');
const mdImages = doc.querySelectorAll('span[is="markdown-image-field"]');

for (const mdImageEl of mdImages) {
mdImageEl.replaceWith(mdImageEl.innerHTML.trim());
}

const editOptionButtons = doc.querySelectorAll('.ignore-md');
for (const editOptionsEl of editOptionButtons) {
editOptionsEl.remove();
}
return doc.body.innerHTML;
};
\`\`\`
const SAMPLE_MARKDOWN = `
`;

export default defineComponent({
Expand Down
Loading