-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Clemens Wolff <[email protected]>
- Loading branch information
Showing
9 changed files
with
214 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>mathquill4quill demo (Vue 3)</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "vuejs", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"start": "vite --port 4043", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@edtr-io/mathquill": "^0.11.0", | ||
"@vueup/vue-quill": "^1.2.0", | ||
"jquery": "^3.7.1", | ||
"katex": "^0.16.8", | ||
"mathquill4quill": "^2.4.0", | ||
"vue": "^3.3.4" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^4.2.3", | ||
"vite": "^4.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<script setup> | ||
import "./jquery"; | ||
// KaTeX dependency | ||
import katex from "katex"; | ||
window.katex = katex; | ||
import { QuillEditor, Quill } from "@vueup/vue-quill"; | ||
import "@edtr-io/mathquill/build/mathquill.js"; | ||
import "@edtr-io/mathquill/build/mathquill.css"; | ||
// mathquill4quill include | ||
import mathquill4quill from "mathquill4quill"; | ||
import "mathquill4quill/mathquill4quill.css"; | ||
import { onMounted, ref } from "vue"; | ||
const operators = [ | ||
["\\pm", "\\pm"], | ||
["\\sqrt{x}", "\\sqrt"], | ||
["\\sqrt[3]{x}", "\\sqrt[3]{}"], | ||
["\\sqrt[n]{x}", "\\nthroot"], | ||
["\\frac{x}{y}", "\\frac"], | ||
["\\sum^{s}_{x}{d}", "\\sum"], | ||
["\\prod^{s}_{x}{d}", "\\prod"], | ||
["\\coprod^{s}_{x}{d}", "\\coprod"], | ||
["\\int^{s}_{x}{d}", "\\int"], | ||
["\\binom{n}{k}", "\\binom"] | ||
]; | ||
const quill = ref(); | ||
const content = ref(""); | ||
onMounted(() => { | ||
// For this line, refer to the following issue comment: | ||
// https://github.com/c-w/mathquill4quill/issues/97#issuecomment-1740482856 | ||
quill.value.container = quill.value.getEditor(); | ||
const enableMathQuillFormulaAuthoring = mathquill4quill({ Quill, katex }); | ||
enableMathQuillFormulaAuthoring(quill.value, { | ||
operators | ||
}); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<main class="demo-container"> | ||
<QuillEditor | ||
id="quill-editor" | ||
v-model:content="content" | ||
theme="snow" | ||
placeholder="Type text here, or click on the formula button to enter math." | ||
ref="quill" | ||
:options="{ | ||
modules: { | ||
formula: true, | ||
toolbar: [['bold', 'italic', 'underline'], ['formula']] | ||
} | ||
}" | ||
/> | ||
|
||
<footer> | ||
<a href="https://github.com/c-w/mathquill4quill"> | ||
<p>Fork me on Github</p> | ||
<img | ||
width="149" | ||
height="149" | ||
src="https://github.blog/wp-content/uploads/2008/12/forkme_right_darkblue_121621.png?resize=149%2C149" | ||
alt="Fork me on GitHub" | ||
/> | ||
</a> | ||
</footer> | ||
</main> | ||
</template> | ||
|
||
<style scoped> | ||
footer { | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
background-color: #121621; | ||
text-align: center; | ||
} | ||
footer a { | ||
color: #fff; | ||
font-family: sans-serif; | ||
} | ||
footer p { | ||
margin: 0.5em; | ||
} | ||
footer img { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
z-index: 99999; | ||
display: none; | ||
} | ||
main { | ||
width: 100%; | ||
height: 200px; | ||
} | ||
@media (min-width: 500px) { | ||
main { | ||
max-width: 400px; | ||
margin: 50px auto; | ||
} | ||
footer p { | ||
display: none; | ||
} | ||
footer img { | ||
display: block; | ||
} | ||
} | ||
label { | ||
padding-top: 0.5em; | ||
display: block; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import $ from "jquery"; | ||
|
||
window.jQuery = window.$ = $; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { createApp } from "vue"; | ||
import "katex/dist/katex.css"; | ||
import "@vueup/vue-quill/dist/vue-quill.bubble.css"; | ||
import "@vueup/vue-quill/dist/vue-quill.snow.css"; | ||
|
||
import "mathquill4quill/mathquill4quill.css"; | ||
|
||
import App from "./App.vue"; | ||
|
||
createApp(App).mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from "vite"; | ||
import vue from "@vitejs/plugin-vue"; | ||
|
||
export default defineConfig({ | ||
plugins: [vue()] | ||
}); |