jack 6 dias atrás
pai
commit
2e1c87bbde

+ 0 - 3
src/assets/styles/prosemirror.scss

@@ -2,9 +2,6 @@
   outline: 0;
   border: 0;
   font-size: 16px;
-  word-break: break-word;
-  white-space: normal;
-
   &:not(.ProseMirror-static) {
     user-select: text;
   }

+ 5 - 3
src/hooks/useImport.ts

@@ -35,7 +35,7 @@ const convertFontSizePtToPx = (html: string, ratio: number, autoFit: any) => {
   if (autoFit?.fontScale && autoFit?.type == "text") { ratio = ratio * autoFit.fontScale / 100; }
   // return html;
   return html.replace(/\s*([\d.]+)pt/g, (match, p1) => {
-    return `${(parseFloat(p1) * ratio - 1) | 0}px `
+    return `${(parseFloat(p1) * ratio) | 0}px `
   })
 
 }
@@ -783,6 +783,8 @@ export default () => {
     }
   
     let transparentPngBlob: Blob;
+    transparentPngBlob = pngBlob;
+    /*
     if (alreadyTransparent) {
       // 图片已有透明背景,直接使用原 PNG Blob
       console.log('检测到透明背景,跳过白色变透明处理');
@@ -791,7 +793,7 @@ export default () => {
       // 否则执行白色变透明处理
       transparentPngBlob = await makeWhiteTransparentFromPng(pngBlob, tolerance);
     }
-  
+  */
     const finalFilename = format === 'png' ? filename : filename.replace(/\.[^.]*$/, '') + '.png';
     return new File([transparentPngBlob], finalFilename, { type: 'image/png' });
   };
@@ -1720,7 +1722,7 @@ export default () => {
                 defaultColor: theme.value.fontColor,
                 content: convertFontSizePtToPx(el.content, ratio, el.autoFit),
                 style: getStyle(convertFontSizePtToPx(el.content, ratio, el.autoFit)),
-                lineHeight: 1.15,
+                lineHeight: 1.5,
                 align: vAlignMap[el.vAlign] || 'middle',
                 outline: {
                   color: el.borderColor,

+ 1 - 0
src/utils/prosemirror/schema/nodes.ts

@@ -200,6 +200,7 @@ const listItem: NodeSpec = {
 };
 
 const paragraph: NodeSpec = {
+  whitespace: "pre",
   attrs: {
     align: { default: '' },
     indent: { default: 0 },

+ 2 - 2
src/views/components/element/ShapeElement/BaseShapeElement.vue

@@ -123,7 +123,7 @@ const text = computed<ShapeText>(() => {
   width: 100%;
   height: 100%;
   position: relative;
-
+  line-height: 1.5;
   svg {
     transform-origin: 0 0;
     overflow: visible;
@@ -143,7 +143,7 @@ const text = computed<ShapeText>(() => {
   padding: 5px;
   word-break: break-word;
   pointer-events: none;
-
+  white-space: break-spaces;
   &.editable {
     pointer-events: all;
   }

+ 2 - 0
src/views/components/element/ShapeElement/index.vue

@@ -240,6 +240,7 @@ const startEdit = () => {
   height: 100%;
   position: relative;
   cursor: move;
+  line-height: 1.5;
 
   svg {
     transform-origin: 0 0;
@@ -264,6 +265,7 @@ const startEdit = () => {
   padding: 5px;
   word-break: break-word;
   pointer-events: none;
+  white-space: break-spaces;
 
   &.editable {
     pointer-events: all;

+ 2 - 2
src/views/components/element/TextElement/BaseTextElement.vue

@@ -77,7 +77,7 @@ const { shadowStyle } = useElementShadow(shadow)
 .element-content {
   position: relative;
   padding: 10px;
-  line-height: 1.15;
+  line-height: 1.5;
   word-break: break-word;
 
   .text {
@@ -101,7 +101,7 @@ const { shadowStyle } = useElementShadow(shadow)
   flex-direction: column;
   word-break: break-word;
   pointer-events: none;
-
+  white-space: break-spaces;
   &.editable {
     pointer-events: all;
   }

+ 2 - 2
src/views/components/element/TextElement/index.vue

@@ -195,7 +195,7 @@ watch(isHandleElement, () => {
 .element-content {
   position: relative;
   padding: 10px;
-  line-height: 1.15;
+  line-height: 1.5;
   word-break: break-word;
   cursor: move;
 
@@ -233,7 +233,7 @@ watch(isHandleElement, () => {
   flex-direction: column;
   word-break: break-word;
   pointer-events: none;
-
+  white-space: break-spaces;
   &.editable {
     pointer-events: all;
   }