Browse Source

空格改成样式

asd123a20 2 years ago
parent
commit
d2dda13195
1 changed files with 3 additions and 2 deletions
  1. 3 2
      admin-frame/src/components/editoritem2.vue

+ 3 - 2
admin-frame/src/components/editoritem2.vue

@@ -53,9 +53,10 @@ export default {
                 line = line.replace(/\r/, '');
                 line = line.replace(/\r/, '');
                 line = line.replace(/(\s{2})/, (all, $1) => {
                 line = line.replace(/(\s{2})/, (all, $1) => {
                   if ($1.charAt(0) == '\n' || $1.charAt(0) == '\r' || $1.charAt(0) == '\x20') return all;
                   if ($1.charAt(0) == '\n' || $1.charAt(0) == '\r' || $1.charAt(0) == '\x20') return all;
-                  return all.replace($1, Array($1.length).fill('    ').join(''));
+                  return all.replace($1, Array($1.length).fill('').join(''));
                 });
                 });
-                nodeList.push({ type: 'paragraph', children: [{ text: line }] });
+                // nodeList.push({ type: 'paragraph', children: [{ text: line }] });
+                nodeList.push({ type: 'paragraph', indent: '2em', children: [{ text: line }] });
               }).join('\n');
               }).join('\n');
               SlateTransforms.insertNodes(editor, nodeList);
               SlateTransforms.insertNodes(editor, nodeList);
               event.preventDefault();
               event.preventDefault();