injectKey.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. import type { InjectionKey, Ref } from 'vue'
  2. export type SlideScale = Ref<number>
  3. export type SlideId = Ref<string>
  4. export type RadioGroupValue = {
  5. value: Ref<string>
  6. updateValue: (value: string) => void
  7. }
  8. export const injectKeySlideScale: InjectionKey<SlideScale> = Symbol()
  9. export const injectKeySlideId: InjectionKey<SlideId> = Symbol()
  10. export const injectKeyRadioGroupValue: InjectionKey<RadioGroupValue> = Symbol()
  11. /**
  12. * 单页模式。EditorEn(英语展示页)专用:整个编辑器只允许存在一页,
  13. * 插入口语工具时用「替换当前全部页面」代替「新增一页」。
  14. *
  15. * provide:views/Editor/indexEn.vue
  16. * inject :EnglishSpeaking/layers/Layer2Speaking.vue —— 建页分支
  17. * hooks/useAddSlidesOrElements.ts —— 挡住 Ctrl+V 贴页 / AIPPT 批量加页
  18. *
  19. * 其余编辑器(index / index2 / index3)不 provide,inject 一律拿到 default false,
  20. * 行为与今天完全一致。因为是 provide 而不是全局 store,值随 EditorEn 一起消失,
  21. * 不存在「切走之后旗标还留着」的问题。
  22. */
  23. export const injectKeySingleSlideMode: InjectionKey<boolean> = Symbol()