Skip to content

Commit 351fe0d

Browse files
committed
add: tokenize method
1 parent f0a7a59 commit 351fe0d

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

frontend/src/components/Navbar.vue

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
:title="$t('Toggle Menu')"
1010
@click="$emit('toggleMenu')"
1111
/>
12+
<q-separator class="q-ml-md" vertical inset />
13+
14+
<q-btn dense flat rouned icon="content_cut" @click="tokenize" />
1215
</q-toolbar>
1316
</template>
1417

@@ -24,6 +27,12 @@ export default {
2427
: "bg-white text-grey-7 shadow-white";
2528
},
2629
},
30+
31+
methods: {
32+
tokenize() {
33+
this.$store.dispatch("editor/tokenizeContent");
34+
},
35+
},
2736
};
2837
</script>
2938

frontend/src/pages/Index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<q-page padding class="column full-height" @click="onFocus">
2+
<q-page class="column full-height" @click="onFocus">
33
<editor ref="editor" class="col" />
44
</q-page>
55
</template>

frontend/src/store/editor/actions.js

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { api } from "boot/axios"
2+
13
export function updateContent({ commit, dispatch}, html) {
24
commit('setContentHTML', html)
35
commit('setLastChange', new Date())
@@ -19,3 +21,11 @@ export function saveFile({ commit }) {
1921
commit('saveContentHTML')
2022
commit('setLastSave')
2123
}
24+
25+
export async function tokenizeContent({ commit, state }) {
26+
console.log(state.contentHTML)
27+
const response = await api.post("/tokens/",
28+
{content: state.contentHTML}
29+
)
30+
console.log(response.data)
31+
}

0 commit comments

Comments
 (0)