| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <template>
- <option-panel-tabs v-model:options="localOptions">
- <template #main-tab>
- <div class="option-panel-container">
- <div class="row q-mt-sm">
- <div class="col-md-12">
- <editor v-model:value="localOptions.text" />
- </div>
- <editor-options v-model:options="localOptions" />
- </div>
- </div>
- </template>
- </option-panel-tabs>
- </template>
- <script>
- import { defineComponent } from 'vue'
- import { mixinOptionPanel } from 'quasar-ui-q-page-builder'
- import OptionPanelTabs from 'quasar-ui-q-page-builder/src/components/OptionPanelComponents/OptionPanelTabs.vue'
- import Editor from 'components/Utils/Editor.vue'
- import EditorOptions from 'components/EditorOptions.vue'
- export default defineComponent({
- name: 'OptionPanel',
- components: { Editor, OptionPanelTabs, EditorOptions },
- mixins: [mixinOptionPanel],
- props: {
- options: {
- type: Object,
- default() {
- return {}
- }
- }
- },
- data() {
- return {
- fontStyle: ['inherit', 'normal', 'italic'],
- foreColor: '#000000',
- token: null,
- responsiveOpts: ['xs', 'sm', 'md', 'lg', 'xl'],
- responsive: 'xs',
- defaultOptions: {
- fontFamily: null,
- color: null,
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- xs: {
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- lineHeight: null
- },
- sm: {
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- lineHeight: null
- },
- md: {
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- lineHeight: null
- },
- lg: {
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- lineHeight: null
- },
- xl: {
- fontSize: null,
- fontWeight: null,
- fontStyle: null,
- lineHeight: null
- }
- }
- }
- },
- watch: {
- localOptions: {
- handler(newVal) {
- this.$emit('update:options', newVal)
- },
- deep: true
- }
- },
- mounted() {
- const windowWidth = window.innerWidth
- if (windowWidth > 1920) {
- this.responsive = 'xl'
- } else if (windowWidth > 1440 < 1920) {
- this.responsive = 'lg'
- } else if (windowWidth > 1024 < 1440) {
- this.responsive = 'md'
- } else if (windowWidth > 600 < 1024) {
- this.responsive = 'sm'
- } else if (windowWidth < 600) {
- this.responsive = 'xs'
- }
- },
- methods: {
- color(cmd, name) {
- const edit = this.$refs.editor
- this.$refs.token.hide()
- edit.caret.restore()
- edit.runCmd(cmd, name)
- edit.focus()
- }
- }
- })
- </script>
|