fixed positioning of textbox
This commit is contained in:
parent
ee49593055
commit
83374615aa
@ -1,27 +1,40 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import { RichTextBox } from "../types.ts";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
statement: { type: String, required: true },
|
value: {
|
||||||
})
|
type: RichTextBox,
|
||||||
|
},
|
||||||
|
// statement: { type: String, required: true },
|
||||||
|
// startingX: { type: Number, default: 0 },
|
||||||
|
// startingY: { type: Number, default: 0 },
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Draggable :grid="[25, 25]">
|
<Draggable
|
||||||
<div style="display: flex">
|
:grid="[5, 5]"
|
||||||
|
:default-position="{ x: props.value.x, y: props.value.y }"
|
||||||
|
>
|
||||||
|
<div style="display: flex; bottom: 10px; right: 0">
|
||||||
<q-card flat bordered>
|
<q-card flat bordered>
|
||||||
<q-card-section style="padding: 0">
|
<q-card-section style="padding: 0">
|
||||||
<div class="row items-center no-wrap">
|
<div class="row items-center no-wrap">
|
||||||
<q-card-section v-html="props.statement" />
|
<q-card-section v-html="props.value.text" />
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<q-btn color="grey-7" round flat icon="more_vert">
|
<q-btn color="grey-7" round flat icon="more_vert">
|
||||||
<q-menu cover auto-close>
|
<q-menu cover auto-close>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section @click="() => $emit('edit')">Edit</q-item-section>
|
<q-item-section @click="() => $emit('edit')"
|
||||||
|
>Edit</q-item-section
|
||||||
|
>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section @click="() => $emit('remove')">Remove</q-item-section>
|
<q-item-section @click="() => $emit('remove')"
|
||||||
|
>Remove</q-item-section
|
||||||
|
>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
|
@ -10,6 +10,7 @@ import Statement from '../components/Statement.vue'
|
|||||||
import VarDeclEditor from './VarDeclEditor.vue'
|
import VarDeclEditor from './VarDeclEditor.vue'
|
||||||
import ExpressionEditor from './ExpressionEditor.vue'
|
import ExpressionEditor from './ExpressionEditor.vue'
|
||||||
import TextBox from '../components/TextBox.vue'
|
import TextBox from '../components/TextBox.vue'
|
||||||
|
import {RichTextBox} from "../types.ts";
|
||||||
|
|
||||||
const math = new MathPage(uuidv4())
|
const math = new MathPage(uuidv4())
|
||||||
const statements = ref<MathStatement[]>([])
|
const statements = ref<MathStatement[]>([])
|
||||||
@ -58,9 +59,9 @@ const saveNewExpression = (stmt: MathStatement) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const richTextStatements = ref([
|
const richTextStatements = ref([
|
||||||
{ text: "test" },
|
new RichTextBox('newText'),
|
||||||
{ text: "test2" },
|
new RichTextBox('newText', 0,100)
|
||||||
{ text: "test3" },
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const richEditModal = ref(false);
|
const richEditModal = ref(false);
|
||||||
@ -110,7 +111,7 @@ function richUpdateValue() {
|
|||||||
<!-- drawer content -->
|
<!-- drawer content -->
|
||||||
</q-drawer>
|
</q-drawer>
|
||||||
|
|
||||||
<q-page-container id="editor" style="display: flex">
|
<q-page-container id="editor" >
|
||||||
<!-- <WrapperBox />-->
|
<!-- <WrapperBox />-->
|
||||||
|
|
||||||
<span v-for="statement in statements">
|
<span v-for="statement in statements">
|
||||||
@ -165,12 +166,12 @@ function richUpdateValue() {
|
|||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
<span v-for="(item, index) in richTextStatements">
|
<div v-for="(item, index) in richTextStatements">
|
||||||
<TextBox
|
<TextBox
|
||||||
:statement="item.text"
|
:value="item"
|
||||||
v-on:edit="() => (item.text ? richEditStatement(index) : {})"
|
v-on:edit="() => (item.text ? richEditStatement(index) : {})"
|
||||||
></TextBox>
|
></TextBox>
|
||||||
</span>
|
</div>
|
||||||
</q-page-container>
|
</q-page-container>
|
||||||
|
|
||||||
<q-footer reveal elevated class="bg-grey-8 text-white">
|
<q-footer reveal elevated class="bg-grey-8 text-white">
|
||||||
|
@ -91,3 +91,12 @@ export interface EvaluationResult {
|
|||||||
variables: Record<VariableName, any>
|
variables: Record<VariableName, any>
|
||||||
statements: Record<StatementID, any>
|
statements: Record<StatementID, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export class RichTextBox {
|
||||||
|
constructor(
|
||||||
|
public text: string = '',
|
||||||
|
public x: Number = 0,
|
||||||
|
public y: Number = 0,
|
||||||
|
) {}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user