Ver código fonte

bug修复和配置调整

pipipi-pikachu 5 anos atrás
pai
commit
f429561668

+ 8 - 0
src/configs/shapes.ts

@@ -79,6 +79,10 @@ export const SHAPE_LIST = [
       },
       {
         viewBox: 200,
+        path: 'M 0 0 L 150 0 L 200 200 L 50 200 L 0 0 Z'
+      },
+      {
+        viewBox: 200,
         path: 'M 50 0 L 150 0 L 200 200 L 0 200 L 50 0 Z'
       },
       {
@@ -119,6 +123,10 @@ export const SHAPE_LIST = [
       },
       {
         viewBox: 200,
+        path: 'M 0 0 L 200 100 L 200 200 L 0 200 L 0 0 Z'
+      },
+      {
+        viewBox: 200,
         path: 'M 50 0 L 150 0 L 150 50 L 200 50 L 200 150 L 150 150 L 150 200 L 50 200 L 50 150 L 0 150 L 0 50 L 50 50 L 50 0 Z'
       },
       {

+ 4 - 2
src/hooks/usePasteTextClipboardData.ts

@@ -48,8 +48,10 @@ export default () => {
   }
 
   const pasteSlide = (slide: Slide) => {
-    const newSlide = { ...slide, id: createRandomCode() }
-    store.commit(MutationTypes.ADD_SLIDE, newSlide)
+    store.commit(MutationTypes.ADD_SLIDE, {
+      ...slide,
+      id: createRandomCode(8),
+    })
     addHistorySnapshot()
   }
 

+ 6 - 1
src/hooks/useSlideHandler.ts

@@ -61,11 +61,16 @@ export default () => {
   }
 
   const copyAndPasteSlide = () => {
-    store.commit(MutationTypes.ADD_SLIDE, currentSlide.value)
+    store.commit(MutationTypes.ADD_SLIDE, {
+      ...currentSlide.value,
+      id: createRandomCode(8),
+    })
     addHistorySnapshot()
   }
 
   const deleteSlide = () => {
+    if(slidesLength.value === 1) return message.warning('无法继续删除')
+    
     store.commit(MutationTypes.DELETE_SLIDE, currentSlide.value.id)
     addHistorySnapshot()
   }

Diferenças do arquivo suprimidas por serem muito extensas
+ 2 - 176
src/mocks/index.ts


+ 1 - 1
src/prosemirror/utils.ts

@@ -86,7 +86,7 @@ export const getTextAttrs = (view: EditorView) => {
   const isCode = isActiveMark(view, 'code')
   const color = getAttrValue(view, 'forecolor', 'color') || '#000'
   const backcolor = getAttrValue(view, 'backcolor', 'backcolor') || '#000'
-  const fontsize = getAttrValue(view, 'fontsize', 'fontsize') || '12px'
+  const fontsize = getAttrValue(view, 'fontsize', 'fontsize') || '20px'
   const fontname = getAttrValue(view, 'fontname', 'fontname') || '微软雅黑'
   const align = getAttrValueInSelection(view, 'align') || 'left'
   const isBulletList = isActiveOfParentNodeType('bullet_list', view.state)

+ 1 - 1
src/views/Editor/Canvas/GridLines.vue

@@ -26,7 +26,7 @@ export default defineComponent({
   setup() {
     const store = useStore()
     const canvasScale = computed(() => store.state.canvasScale)
-    const background = computed<SlideBackground | undefined>(() => store.getters.currentSlide.background)
+    const background = computed<SlideBackground | undefined>(() => store.getters.currentSlide?.background)
 
     const gridColor = computed(() => {
       if(!background.value || background.value.type === 'image') return 'rgba(100, 100, 100, 0.5)'

+ 1 - 1
src/views/Editor/Canvas/SlideBackground.vue

@@ -22,7 +22,7 @@ export default defineComponent({
   setup() {
     const store = useStore()
     const showGridLines = computed(() => store.state.showGridLines)
-    const background = computed<SlideBackground | undefined>(() => store.getters.currentSlide.background)
+    const background = computed<SlideBackground | undefined>(() => store.getters.currentSlide?.background)
 
     const { backgroundStyle } = useSlideBackgroundStyle(background)
 

+ 5 - 4
src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue

@@ -343,7 +343,7 @@ export default defineComponent({
       code: false,
       color: '#000',
       backcolor: '#000',
-      fontsize: '12px',
+      fontsize: '20px',
       fontname: '微软雅黑',
       align: 'left',
       bulletList: false,
@@ -354,10 +354,11 @@ export default defineComponent({
     const availableFonts = computed(() => store.state.availableFonts)
     const fontSizeOptions = [
       '12px', '14px', '16px', '18px', '20px', '22px', '24px', '28px', '32px',
-      '36px', '40px', '44px', '48px', '54px', '60px', '66px', '72px', '80px',
+      '36px', '40px', '44px', '48px', '54px', '60px', '66px', '72px', '76px',
+      '80px', '88px', '96px', '104px', '112px', '120px',
     ]
-    const lineHeightOptions = [0.5, 1.0, 1.2, 1.5, 1.8, 2.0, 3.0]
-    const wordSpaceOptions = [0, 1, 2, 3, 4, 5, 8]
+    const lineHeightOptions = [0.9, 1.0, 1.15, 1.2, 1.4, 1.5, 1.8, 2.0, 2.5, 3.0]
+    const wordSpaceOptions = [0, 1, 2, 3, 4, 5, 6, 8, 10]
 
     const updateRichTextAttrs = (attr: TextAttrs) => richTextAttrs.value = attr