Просмотр исходного кода

设置富文本默认1.75倍行距

新文章初始段落默认行距设为1.75倍,并继续继承仿宋_GB2312、20pt及首行缩进2字符。\n\nWord 导入和粘贴内容保留已有行距,仅对未指定行距的普通段落补1.75倍。更新三个文章编辑页面的脚本缓存版本。\n\nValidation:\n- node --check WebRoot/apps/space/js/space.vue.subassembly.js\n- git diff --cached --check
非繁 2 недель назад
Родитель
Сommit
9be63ad837

+ 11 - 3
WebRoot/apps/space/js/space.vue.subassembly.js

@@ -400,6 +400,7 @@ Vue.component('spaceEditor', {
 			_pdfEnhancing: false,
 			defaultEditorFontFamily: "'仿宋_GB2312', 'FangSong_GB2312', FangSong, serif",
 			defaultEditorFontSize: "20pt",
+			defaultEditorLineHeight: "1.75",
 		}
 	},
 	name: "spaceEditor",
@@ -2361,7 +2362,7 @@ Vue.component('spaceEditor', {
 				} else if (blockText != "") {
 					textBlock.style.textAlign = "justify";
 					textBlock.style.textIndent = "2em";
-					textBlock.style.lineHeight = "1.8";
+					textBlock.style.lineHeight = "1.75";
 					trimFirstTextIndent(textBlock);
 				}
 			}
@@ -2479,7 +2480,7 @@ Vue.component('spaceEditor', {
 						if (result.messages && result.messages.length) {
 							wordUi.showMessage('warning', 'Word 已导入,少量复杂格式可能需要人工检查。');
 						} else {
-							wordUi.showMessage('success', 'Word 文件已导入正文,原有段落格式已尽量保留;未指定格式的段落使用仿宋_GB2312、20pt、首行缩进2字符。');
+							wordUi.showMessage('success', 'Word 文件已导入正文,原有段落格式已尽量保留;未指定格式的段落使用仿宋_GB2312、20pt、首行缩进2字符、1.75倍行距。');
 						}
 					}.bind(this))
 					.catch(function (error) {
@@ -2561,6 +2562,9 @@ Vue.component('spaceEditor', {
 					} else if (!textIndent && /^(P|LI|BLOCKQUOTE)$/i.test(node.tagName)) {
 						node.style.textIndent = '2em';
 					}
+					if (!(node.style && node.style.lineHeight) && /^(P|LI|BLOCKQUOTE)$/i.test(node.tagName)) {
+						node.style.lineHeight = this.defaultEditorLineHeight;
+					}
 					if (node.getAttribute && node.getAttribute('align')) {
 						node.style.textAlign = node.getAttribute('align');
 						node.removeAttribute('align');
@@ -2652,9 +2656,13 @@ Vue.component('spaceEditor', {
 					if (editor.model.schema.checkAttribute(firstBlock.name, 'textIndent')) {
 						writer.setAttribute('textIndent', '2em', firstBlock);
 					}
-				});
+					if (editor.model.schema.checkAttribute(firstBlock.name, 'lineHeight')) {
+						writer.setAttribute('lineHeight', this.defaultEditorLineHeight, firstBlock);
+					}
+				}.bind(this));
 				editor.execute('fontFamily', { value: this.defaultEditorFontFamily });
 				editor.execute('fontSize', { value: this.defaultEditorFontSize });
+				this.refreshLineHeightControl(editor);
 			},
 			convertWordWithServer: function (file) {
 				var formData = new FormData();

+ 1 - 1
WebRoot/web/subassembly/app/pc/10021/10104/1002110104_run.jsp

@@ -18,7 +18,7 @@
  <script src="/apps/space/plug-in/element-resize-detector/element-resize-detector.min.js"></script> 
  <script src="/apps/space/plug-in/vue/vue.min.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/apps/space/plug-in/element-ui@2.13.0/index.js" type="text/javascript" charset="utf-8"></script> 
- <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent-line-height"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.recycle.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.display.js?v=20261110-title-submit-v2" type="text/javascript" charset="utf-8"></script>

+ 1 - 1
WebRoot/web/subassembly/app/pc/10021/10105/1002110105_run.jsp

@@ -18,7 +18,7 @@
  <script src="/apps/space/plug-in/element-resize-detector/element-resize-detector.min.js"></script> 
  <script src="/apps/space/plug-in/vue/vue.min.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/apps/space/plug-in/element-ui@2.13.0/index.js" type="text/javascript" charset="utf-8"></script> 
- <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent-line-height"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.recycle.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.display.js?v=20261110-title-submit-v2" type="text/javascript" charset="utf-8"></script>

+ 1 - 1
WebRoot/web/subassembly/app/pc/10021/10211/1002110211_run.jsp

@@ -18,7 +18,7 @@
  <script src="/apps/space/plug-in/element-resize-detector/element-resize-detector.min.js"></script> 
  <script src="/apps/space/plug-in/vue/vue.min.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/apps/space/plug-in/element-ui@2.13.0/index.js" type="text/javascript" charset="utf-8"></script> 
- <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent-line-height"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.recycle.js" type="text/javascript" charset="utf-8"></script> 
  <script src="/js/space.display.js?v=20261110-title-submit-v2" type="text/javascript" charset="utf-8"></script>