فهرست منبع

设置富文本默认首行缩进两字符

新文章初始段落默认应用 text-indent:2em,并继续继承仿宋_GB2312、20pt默认格式。\n\nWord 导入时保留已有首行缩进和明确的无缩进设置;仅对未指定缩进的普通段落补首行缩进2字符。更新三个文章编辑页面的脚本缓存版本。\n\nValidation:\n- node --check WebRoot/apps/space/js/space.vue.subassembly.js\n- git diff --cached --check
非繁 2 هفته پیش
والد
کامیت
4bd4ec2392

+ 6 - 1
WebRoot/apps/space/js/space.vue.subassembly.js

@@ -2479,7 +2479,7 @@ Vue.component('spaceEditor', {
 						if (result.messages && result.messages.length) {
 						if (result.messages && result.messages.length) {
 							wordUi.showMessage('warning', 'Word 已导入,少量复杂格式可能需要人工检查。');
 							wordUi.showMessage('warning', 'Word 已导入,少量复杂格式可能需要人工检查。');
 						} else {
 						} else {
-							wordUi.showMessage('success', 'Word 文件已导入正文,原有字体和字号已尽量保留;未指定格式的文字使用仿宋_GB2312、20pt。');
+							wordUi.showMessage('success', 'Word 文件已导入正文,原有段落格式已尽量保留;未指定格式的段落使用仿宋_GB2312、20pt、首行缩进2字符。');
 						}
 						}
 					}.bind(this))
 					}.bind(this))
 					.catch(function (error) {
 					.catch(function (error) {
@@ -2558,6 +2558,8 @@ Vue.component('spaceEditor', {
 					var textIndent = node.style && node.style.textIndent;
 					var textIndent = node.style && node.style.textIndent;
 					if (textIndent && !/^0(?:px|pt|em|%)?$/i.test(textIndent.trim())) {
 					if (textIndent && !/^0(?:px|pt|em|%)?$/i.test(textIndent.trim())) {
 						node.style.textIndent = '2em';
 						node.style.textIndent = '2em';
+					} else if (!textIndent && /^(P|LI|BLOCKQUOTE)$/i.test(node.tagName)) {
+						node.style.textIndent = '2em';
 					}
 					}
 					if (node.getAttribute && node.getAttribute('align')) {
 					if (node.getAttribute && node.getAttribute('align')) {
 						node.style.textAlign = node.getAttribute('align');
 						node.style.textAlign = node.getAttribute('align');
@@ -2647,6 +2649,9 @@ Vue.component('spaceEditor', {
 						firstBlock = writer.appendElement('paragraph', root);
 						firstBlock = writer.appendElement('paragraph', root);
 					}
 					}
 					writer.setSelection(firstBlock, 'in');
 					writer.setSelection(firstBlock, 'in');
+					if (editor.model.schema.checkAttribute(firstBlock.name, 'textIndent')) {
+						writer.setAttribute('textIndent', '2em', firstBlock);
+					}
 				});
 				});
 				editor.execute('fontFamily', { value: this.defaultEditorFontFamily });
 				editor.execute('fontFamily', { value: this.defaultEditorFontFamily });
 				editor.execute('fontSize', { value: this.defaultEditorFontSize });
 				editor.execute('fontSize', { value: this.defaultEditorFontSize });

+ 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/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/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="/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"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></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.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>
  <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/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/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="/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"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></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.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>
  <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/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/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="/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"></script>
+ <script src="/js/space.vue.pc.subassembly.js?v=20261110-default-typography-indent"></script>
  <script src="/apps/space/plug-in/layui/dist/layui.all.js" type="text/javascript" charset="utf-8"></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.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>
  <script src="/js/space.display.js?v=20261110-title-submit-v2" type="text/javascript" charset="utf-8"></script>