Merge branch 'main' into qi
This commit is contained in:
47
src/components/ImageBox.vue
Normal file
47
src/components/ImageBox.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { RichTextBox } from "../types.ts";
|
||||
import { stepX, stepY } from "../support/const.ts";
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: RichTextBox,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Draggable
|
||||
:grid="[stepX, stepY]"
|
||||
:default-position="{ x: props.value.x, y: props.value.y }"
|
||||
>
|
||||
<div>
|
||||
<q-card flat bordered>
|
||||
<q-card-section style="padding: 0">
|
||||
<div class="row items-center no-wrap">
|
||||
<q-card-section v-html="props.value.text" />
|
||||
<div class="col-auto">
|
||||
<q-btn color="grey-7" round flat icon="more_vert">
|
||||
<q-menu cover auto-close>
|
||||
<q-list>
|
||||
<q-item clickable>
|
||||
<q-item-section @click="() => $emit('edit')"
|
||||
>Edit</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
<q-item clickable>
|
||||
<q-item-section @click="() => $emit('remove')"
|
||||
>Remove</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</Draggable>
|
||||
</template>
|
||||
|
||||
<style lang="sass" scoped></style>
|
||||
@@ -7,19 +7,26 @@ const props = defineProps<{
|
||||
size?: 'big' | 'small',
|
||||
}>()
|
||||
|
||||
const getRenderedHTML = () => props.statement.toHTMLString()
|
||||
const getRenderedHTML = () => {
|
||||
console.log('getRenderedHTML', props.statement)
|
||||
try {
|
||||
return props.statement.toHTMLString()
|
||||
} catch (_) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const renderedHtml = getRenderedHTML()
|
||||
computed(getRenderedHTML)
|
||||
let renderedHtml = getRenderedHTML()
|
||||
computed(() => renderedHtml = getRenderedHTML())
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.big {
|
||||
transform: scale(1.3);
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.small {
|
||||
transform: scale(0.9);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
0
src/components/RichTextModal.vue
Normal file
0
src/components/RichTextModal.vue
Normal file
@@ -6,11 +6,11 @@ import Katex from './Katex.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
statement: MathStatement,
|
||||
evaluation: EvaluationResult,
|
||||
evaluation?: EvaluationResult,
|
||||
}>()
|
||||
|
||||
const getValueStatement = (): Maybe<MathStatement> => {
|
||||
const value = props.evaluation.statements[props.statement.id]
|
||||
const value = props.evaluation?.statements?.[props.statement.id]
|
||||
if ( value ) {
|
||||
return MathStatement.temp(String(value))
|
||||
}
|
||||
@@ -36,10 +36,18 @@ computed(() => value = getValueStatement())
|
||||
.sidebar {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.edit-button {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.edit-button:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="math-statement">
|
||||
<div class="math-statement" style="background: white">
|
||||
<div class="content">
|
||||
<Katex :statement="statement" size="big"/>
|
||||
<div class="result" v-if="value">
|
||||
@@ -48,7 +56,7 @@ computed(() => value = getValueStatement())
|
||||
</div>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<button>
|
||||
<button class="edit-button" @click="() => $emit('edit')" title="Edit this expression">
|
||||
<img src="../assets/edit.svg" alt="Edit" height="16">
|
||||
</button>
|
||||
</div>
|
||||
|
||||
47
src/components/TextBox.vue
Normal file
47
src/components/TextBox.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { RichTextBox } from "../types.ts";
|
||||
import { stepX, stepY } from "../support/const.ts";
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: RichTextBox,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Draggable
|
||||
:grid="[stepX, stepY]"
|
||||
:default-position="{ x: props.value.x, y: props.value.y }"
|
||||
>
|
||||
<div>
|
||||
<q-card flat bordered>
|
||||
<q-card-section style="padding: 0">
|
||||
<div class="row items-center no-wrap">
|
||||
<q-card-section v-html="props.value.text" />
|
||||
<div class="col-auto">
|
||||
<q-btn color="grey-7" round flat icon="more_vert">
|
||||
<q-menu cover auto-close>
|
||||
<q-list>
|
||||
<q-item clickable>
|
||||
<q-item-section @click="() => $emit('edit')"
|
||||
>Edit</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
<q-item clickable>
|
||||
<q-item-section @click="() => $emit('remove')"
|
||||
>Remove</q-item-section
|
||||
>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</Draggable>
|
||||
</template>
|
||||
|
||||
<style lang="sass" scoped></style>
|
||||
27
src/components/WrapperBox.vue
Normal file
27
src/components/WrapperBox.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
const count = ref(0);
|
||||
function increment() {
|
||||
count.value++
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Draggable :grid="[25, 25]">
|
||||
<div>
|
||||
<div>Grid with component</div>
|
||||
|
||||
<q-btn @click="increment">Count is: {{ count }}</q-btn>
|
||||
|
||||
</div>
|
||||
</Draggable>
|
||||
</template>
|
||||
<style lang="sass" scoped>
|
||||
.my-card
|
||||
width: 50%
|
||||
max-width: 250px
|
||||
</style>
|
||||
Reference in New Issue
Block a user