@slidev/client 0.43.12 → 0.43.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { ignorableWatch, onClickOutside } from '@vueuse/core'
3
- import { nextTick, ref, watch } from 'vue'
2
+ import { ignorableWatch, onClickOutside, useVModel } from '@vueuse/core'
3
+ import { ref, watch, watchEffect } from 'vue'
4
4
  import { currentSlideId } from '../logic/nav'
5
5
  import { useDynamicSlideInfo } from '../logic/note'
6
6
  import NoteDisplay from './NoteDisplay.vue'
@@ -9,6 +9,9 @@ const props = defineProps({
9
9
  class: {
10
10
  default: '',
11
11
  },
12
+ editing: {
13
+ default: false,
14
+ },
12
15
  style: {
13
16
  default: () => ({}),
14
17
  },
@@ -17,6 +20,11 @@ const props = defineProps({
17
20
  },
18
21
  })
19
22
 
23
+ const emit = defineEmits([
24
+ 'update:editing',
25
+ ])
26
+ const editing = useVModel(props, 'editing', emit, { passive: true })
27
+
20
28
  const { info, update } = useDynamicSlideInfo(currentSlideId)
21
29
 
22
30
  const note = ref('')
@@ -45,17 +53,11 @@ watch(
45
53
  )
46
54
 
47
55
  const input = ref<HTMLTextAreaElement>()
48
- const editing = ref(false)
49
-
50
- async function switchNoteEdit(e: MouseEvent) {
51
- if ((e?.target as HTMLElement)?.tagName === 'A')
52
- return
53
56
 
54
- editing.value = true
55
- input.value?.focus()
56
- await nextTick()
57
- input.value?.focus()
58
- }
57
+ watchEffect(() => {
58
+ if (editing.value)
59
+ input.value?.focus()
60
+ })
59
61
 
60
62
  onClickOutside(input, () => {
61
63
  editing.value = false
@@ -64,13 +66,12 @@ onClickOutside(input, () => {
64
66
 
65
67
  <template>
66
68
  <NoteDisplay
67
- v-if="!editing && note"
69
+ v-if="!editing"
68
70
  class="my--4 border-transparent border-2"
69
- :class="props.class"
71
+ :class="[props.class, note ? '' : 'opacity-50']"
70
72
  :style="props.style"
71
- :note="note"
73
+ :note="note || placeholder"
72
74
  :note-html="info?.noteHTML"
73
- @click="switchNoteEdit"
74
75
  />
75
76
  <textarea
76
77
  v-else
@@ -30,6 +30,8 @@ useHead({
30
30
  title: `Presenter - ${slideTitle}`,
31
31
  })
32
32
 
33
+ const notesEditing = ref(false)
34
+
33
35
  const { timer, resetTimer } = useTimer()
34
36
 
35
37
  const nextTabElements = ref([])
@@ -143,6 +145,7 @@ onMounted(() => {
143
145
  <NoteEditor
144
146
  v-if="__DEV__"
145
147
  class="w-full max-w-full h-full overflow-auto p-2 lg:p-4"
148
+ :editing="notesEditing"
146
149
  :style="{ fontSize: `${presenterNotesFontSize}em` }"
147
150
  />
148
151
  <NoteStatic
@@ -159,6 +162,13 @@ onMounted(() => {
159
162
  <HiddenText text="Decrease font size" />
160
163
  <carbon:zoom-out />
161
164
  </button>
165
+ <button
166
+ v-if="__DEV__"
167
+ class="slidev-icon-btn" @click="notesEditing = !notesEditing"
168
+ >
169
+ <HiddenText text="Edit Notes" />
170
+ <carbon:edit />
171
+ </button>
162
172
  </div>
163
173
  </div>
164
174
  <div class="grid-section bottom">
@@ -212,7 +222,7 @@ onMounted(() => {
212
222
  }
213
223
 
214
224
  .grid-container.layout2 {
215
- grid-template-columns: 2fr 1fr;
225
+ grid-template-columns: 3fr 2fr;
216
226
  grid-template-rows: min-content 2fr 1fr min-content;
217
227
  grid-template-areas:
218
228
  "top top"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.43.12",
3
+ "version": "0.43.13",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  "vue-router": "^4.2.5",
46
46
  "vue-starport": "^0.4.0",
47
47
  "windicss": "^3.5.6",
48
- "@slidev/parser": "0.43.12",
49
- "@slidev/types": "0.43.12"
48
+ "@slidev/types": "0.43.13",
49
+ "@slidev/parser": "0.43.13"
50
50
  },
51
51
  "devDependencies": {
52
52
  "vite": "^4.5.0"