Skip to content

Commit a01edb1

Browse files
committed
fix: 重新加上summernote控件,还原原有platform 1.23中相关效果,包括只读和编辑状态,只在审批王中生效 #8181
1 parent 18872d7 commit a01edb1

27 files changed

+670
-180
lines changed

creator/.meteor/packages

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ steedos:autoform-dx-date-box
6363

6464
vazco:universe-autoform-select
6565

66-
# summernote:[email protected]
67-
66+
67+
6868

6969
# steedos:devexpress
7070

creator/.meteor/versions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ [email protected]
9191
9292
9393
94+
9495
9596
9697
@@ -199,6 +200,8 @@ steedos:[email protected]
199200
200201
201202
203+
204+
202205
203206
204207

creator/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
"lodash.memoize": "^4.1.2",
106106
"moleculer": "^0.14.25",
107107
"push.js": "^1.0.12",
108-
"react-highlighter": "^0.4.3"
108+
"react-highlighter": "^0.4.3",
109+
"summernote": "^0.8.11"
109110
},
110111
"resolutions": {
111112
"**/hoek": "^5.0.3",

creator/packages/steedos-autoform/client/coreform/inputTypes/coreform-html/html.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
<!--
2+
* @Author: yinlianghui [email protected]
3+
* @Date: 2025-11-13 12:04:53
4+
* @LastEditors: yinlianghui [email protected]
5+
* @LastEditTime: 2025-12-08 13:50:59
6+
* @FilePath: /steedos-platform/creator/packages/steedos-autoform/client/coreform/inputTypes/coreform-html/html.html
7+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8+
-->
19
<template name="steedosInputHtml">
210
{{#if isReadOnly}}
311
<div {{attsPlusFormControlClass}}>
4-
{{{this.value}}}
12+
<div class="steedos-html">
13+
{{{this.value}}}
14+
</div>
515
</div>
616
<input type="text" value="{{this.value}}" {{this.atts}} {{attsPlusFormControlClass}} style="display: none"/>
717
{{else}}

creator/packages/steedos-autoform/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Package.onUse(function(api) {
116116
api.addFiles('client/coreform/inputTypes/coreform-date-mobile/date.html', 'client');
117117
api.addFiles('client/coreform/inputTypes/coreform-date-mobile/date.js', 'client');
118118

119-
// api.addFiles('client/coreform/inputTypes/coreform-summernote/summernote-zh-CN.js', 'client');
119+
api.addFiles('client/coreform/inputTypes/coreform-summernote/summernote-zh-CN.js', 'client');
120120

121121
api.addFiles('client/coreform/inputTypes/coreform-html/html.html', 'client');
122122
api.addFiles('client/coreform/inputTypes/coreform-html/html.js', 'client');

creator/packages/steedos-creator/package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Package.onUse(function (api) {
4040
api.use('steedos:[email protected]');
4141
api.use('steedos:[email protected]');
4242

43-
// api.use('summernote:[email protected]');
44-
// api.use('mpowaga:[email protected]');
43+
api.use('summernote:[email protected]');
44+
api.use('mpowaga:[email protected]');
4545

4646
api.use('meteorhacks:[email protected]');
4747
api.use('meteorhacks:[email protected]');

creator/packages/steedos-workflow/client/lib/2_steedos_data_format.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -247,29 +247,29 @@ var s_autoform = function (schema, field) {
247247
schema.type = String;
248248
autoform.readonly = (permission === 'readonly');
249249
autoform.disabled = (permission === 'readonly');
250-
autoform.type = 'steedosHtml';
251-
// if(permission == 'readonly'){
252-
// autoform.type = 'steedosHtml';
253-
// }
254-
// else{
255-
// var locale = Steedos.locale();
256-
// if (locale === "zh-cn" || locale === "zh-CN") {
257-
// locale = "zh-CN";
258-
// } else {
259-
// locale = "en-US";
260-
// }
261-
// autoform.afFieldInput = {
262-
// type: "summernote",
263-
// class: 'summernote-editor',
264-
// settings: {
265-
// height: 200,
266-
// dialogsInBody: true,
267-
// toolbar: [['font1', ['style']], ['font2', ['bold', 'underline', 'italic', 'clear']], ['font3', ['fontname']], ['color', ['color']], ['insert', ['link']]],
268-
// fontNames: ['Arial', 'Comic Sans MS', 'Courier New', 'Helvetica', 'Impact', '宋体', '黑体', '微软雅黑', '仿宋', '楷体', '隶书', '幼圆'],
269-
// lang: locale
270-
// }
271-
// };
272-
// }
250+
// autoform.type = 'steedosHtml';
251+
if(permission == 'readonly'){
252+
autoform.type = 'steedosHtml';
253+
}
254+
else{
255+
var locale = Steedos.locale();
256+
if (locale === "zh-cn" || locale === "zh-CN") {
257+
locale = "zh-CN";
258+
} else {
259+
locale = "en-US";
260+
}
261+
autoform.afFieldInput = {
262+
type: "summernote",
263+
class: 'summernote-editor',
264+
settings: {
265+
height: 200,
266+
dialogsInBody: true,
267+
toolbar: [['font1', ['style']], ['font2', ['bold', 'underline', 'italic', 'clear']], ['font3', ['fontname']], ['color', ['color']], ['insert', ['link']]],
268+
fontNames: ['Arial', 'Comic Sans MS', 'Courier New', 'Helvetica', 'Impact', '宋体', '黑体', '微软雅黑', '仿宋', '楷体', '隶书', '幼圆'],
269+
lang: locale
270+
}
271+
};
272+
}
273273
break;
274274
case 'image':
275275
if(is_multiselect){

creator/packages/steedos-workflow/client/views/instance/instance_form.less

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,4 +1601,175 @@ _:-ms-fullscreen,
16011601
.slds-select_container:before{
16021602
display: none;
16031603
}
1604-
}
1604+
}
1605+
1606+
1607+
1608+
/** 审批王富文本控件 summernote 相关样式,从 platform 1.23 迁移到此处 ===start=== **/
1609+
.fix-note-editor-in-steedos {
1610+
1611+
/*html片段直接放到cms文章的正文代码编辑框中,结果显示效果不对 #1613*/
1612+
/*把bootstrap/less/core.less、bootstrap/less/type.less、steedos-theme/client/core.less部分被其他样式库覆盖的样式强行再加上*/
1613+
pre {
1614+
background-color: #f5f5f5;
1615+
border: 1px solid #ccc;
1616+
padding: 9.5px;
1617+
margin: 0 0 10px;
1618+
}
1619+
1620+
blockquote {
1621+
padding: 10px 20px;
1622+
margin: 0 0 20px;
1623+
font-size: 17.5px;
1624+
border-left: 5px solid #eeeeee;
1625+
}
1626+
1627+
h2,
1628+
.h2 {
1629+
font-size: 22px;
1630+
}
1631+
1632+
h1,
1633+
.h1,
1634+
h2,
1635+
.h2,
1636+
h3,
1637+
.h3 {
1638+
margin-top: 20px;
1639+
margin-bottom: 10px;
1640+
}
1641+
1642+
h1,
1643+
h2,
1644+
h3,
1645+
h4,
1646+
h5,
1647+
h6,
1648+
.h1,
1649+
.h2,
1650+
.h3,
1651+
.h4,
1652+
.h5,
1653+
.h6 {
1654+
font-weight: bold;
1655+
font-family: Helvetica, Arial, Microsoft Yahei, SimHei;
1656+
}
1657+
1658+
p {
1659+
margin: 0 0 10px;
1660+
}
1661+
1662+
// fix summernote控件字体大小被其他库样式覆盖了,从bootstrap.css的样式中copy过来
1663+
h1,
1664+
.h1 {
1665+
font-size: 36px;
1666+
}
1667+
1668+
h2,
1669+
.h2 {
1670+
font-size: 30px;
1671+
}
1672+
1673+
h3,
1674+
.h3 {
1675+
font-size: 24px;
1676+
}
1677+
1678+
h4,
1679+
.h4 {
1680+
font-size: 18px;
1681+
}
1682+
1683+
h5,
1684+
.h5 {
1685+
font-size: 14px;
1686+
}
1687+
1688+
h6,
1689+
.h6 {
1690+
font-size: 12px;
1691+
}
1692+
1693+
// 表格样式统一显示为类似saleforce样式效果
1694+
table {
1695+
border: solid 1px #dddbda;
1696+
1697+
tr {
1698+
height: auto !important;
1699+
width: auto !important;
1700+
1701+
td {
1702+
border-top: 1px solid #dddbda !important;
1703+
border-left: 1px solid #dddbda !important;
1704+
height: auto !important;
1705+
width: auto !important;
1706+
white-space: nowrap;
1707+
padding: .25rem .75rem;
1708+
}
1709+
1710+
&:first-child {
1711+
1712+
// 因为从excel中copy表格内容进来不带thead/th标签,所以统一把第一行tr/td优化为表头样式
1713+
td {
1714+
background-color: #f4f4f4;
1715+
color: #514f4d;
1716+
font-weight: 700;
1717+
}
1718+
}
1719+
}
1720+
}
1721+
}
1722+
1723+
.note-editor {
1724+
.fix-note-editor-in-steedos
1725+
}
1726+
1727+
.note-editor {
1728+
.note-toolbar {
1729+
1730+
// fix summernote控件toolbar样式应该在fix-note-editor-in-steedos代码基础上优化下
1731+
pre {
1732+
padding: 3px 6px 6px 6px;
1733+
margin: 0;
1734+
color: #777;
1735+
}
1736+
1737+
blockquote {
1738+
padding: 5px 10px;
1739+
margin: 0;
1740+
}
1741+
1742+
h1,
1743+
.h1,
1744+
h2,
1745+
.h2,
1746+
h3,
1747+
.h3 {
1748+
margin-top: 0;
1749+
margin-bottom: 0;
1750+
}
1751+
1752+
p {
1753+
margin: 0;
1754+
padding: 0 0 3px 0;
1755+
}
1756+
1757+
.btn-default {
1758+
// fix 审批王申请单中summernote控件toolbar中的btn-default被重写为透明了
1759+
background-color: #f4f4f4;
1760+
border-color: #ddd;
1761+
}
1762+
}
1763+
}
1764+
1765+
.steedos-html {
1766+
// 审批王html只读字段效果在这里用到
1767+
.fix-note-editor-in-steedos
1768+
}
1769+
1770+
.steedos-html {
1771+
// fix 审批王申请单html字段只读时可能会出现表格溢出
1772+
overflow: auto;
1773+
}
1774+
1775+
/** 审批王富文本控件 summernote 相关样式 ===end=== **/

creator/packages/steedos-workflow/client/views/instance/instance_view.coffee

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ Template.instance_view.onRendered ->
201201
$('.instance-wrapper .instance-view').toggleClass 'suggestion-active'
202202
InstanceManager.fixInstancePosition(true)
203203

204-
# summernoteContainer = $(".instance .note-editor .note-editable")
205-
# if summernoteContainer.length
206-
# # 如果申请单中存在summernote控件,则应该阻止其鼠标滚轮事件冒泡,否则控件内无法通过鼠标滚轮来滚动内容
207-
# summernoteContainer.on 'mousewheel DOMMouseScroll', (e) ->
208-
# if this.scrollHeight > $(this).outerHeight()
209-
# # 只有出现滚动条时才阻止其鼠标滚轮事件冒泡,这样字段内容少时,可以正常滚动最外面的滚动条
210-
# e.stopPropagation()
204+
summernoteContainer = $(".instance .note-editor .note-editable")
205+
if summernoteContainer.length
206+
# 如果申请单中存在summernote控件,则应该阻止其鼠标滚轮事件冒泡,否则控件内无法通过鼠标滚轮来滚动内容
207+
summernoteContainer.on 'mousewheel DOMMouseScroll', (e) ->
208+
if this.scrollHeight > $(this).outerHeight()
209+
# 只有出现滚动条时才阻止其鼠标滚轮事件冒泡,这样字段内容少时,可以正常滚动最外面的滚动条
210+
e.stopPropagation()
211211

212212
else if isNeedActiveSuggestion
213213
preScrollTop = 0

creator/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7693,6 +7693,11 @@ subscriptions-transport-ws@^0.9.18, subscriptions-transport-ws@^0.9.19:
76937693
symbol-observable "^1.0.4"
76947694
ws "^5.2.0 || ^6.0.0 || ^7.0.0"
76957695

7696+
summernote@^0.8.11:
7697+
version "0.8.20"
7698+
resolved "https://registry.npmjs.org/summernote/-/summernote-0.8.20.tgz#395905f2cec0aceebc712edc019d91b8ef88f7cf"
7699+
integrity sha512-W9RhjQjsn+b1s9xiJQgJbCiYGJaDAc9CdEqXo+D13WuStG8lCdtKaO5AiNiSSMJsQJN2EfGSwbBQt+SFE2B8Kw==
7700+
76967701
superagent@^8.0.0:
76977702
version "8.0.0"
76987703
resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.0.0.tgz#2ea4587df4b81ef023ec01ebc6e1bcb9e2344cb6"

0 commit comments

Comments
 (0)