@voplus/morpho-document 6.0.101 → 6.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/modules/message-template/components/MessageTemplateContent/index.d.ts +1 -0
- package/es/modules/message-template/components/MessageTemplateContent/index.js +21 -7
- package/es/modules/message-template/components/MessageTemplateContent/index.js.map +1 -1
- package/es/modules/message-template/components/MessageTemplateContent/index.less +51 -12
- package/es/modules/message-template/components/MessageTemplatePropertiesView/index.js +1 -1
- package/es/modules/message-template/components/MessageTemplatePropertiesView/index.js.map +1 -1
- package/es/modules/message-template/components/MessageTemplateTabs/index.d.ts +2 -0
- package/es/modules/message-template/components/MessageTemplateTabs/index.js +12 -14
- package/es/modules/message-template/components/MessageTemplateTabs/index.js.map +1 -1
- package/es/modules/message-template/pages/MessageTemplateDefaultView/index.js +3 -21
- package/es/modules/message-template/pages/MessageTemplateDefaultView/index.js.map +1 -1
- package/es/modules/message-template/pages/MessageTemplateDefaultView/index.less +4 -31
- package/package.json +1 -1
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { observe } from "@voplus/morpho-ui";
|
|
3
|
-
import { Skeleton } from "antd";
|
|
4
|
-
import { useMessageTemplate } from "../../../../data/message-template";
|
|
3
|
+
import { Skeleton, Space, Button } from "antd";
|
|
4
|
+
import { useMessageTemplate, useMessageTemplateStore } from "../../../../data/message-template";
|
|
5
|
+
import CodeMirror from "../../components/CodeMirror";
|
|
5
6
|
import "./index.less";
|
|
6
7
|
const MessageTemplateContent = (props) => {
|
|
7
8
|
const messageTemplate = useMessageTemplate(props.id, { reload: true, includes: "layout" });
|
|
9
|
+
const store = useMessageTemplateStore();
|
|
10
|
+
const [edit, setEdit] = useState(false);
|
|
11
|
+
const [codeContent, setCodeContent] = useState();
|
|
8
12
|
return observe(() => {
|
|
9
13
|
var _a;
|
|
10
|
-
return (React.createElement(
|
|
11
|
-
React.createElement("div", { className: "message-template-
|
|
12
|
-
React.createElement(
|
|
14
|
+
return (React.createElement("div", { className: "message-template-page" },
|
|
15
|
+
props.canEdit && (React.createElement("div", { className: "message-template-body-header" }, edit ? (React.createElement(Space, null,
|
|
16
|
+
React.createElement(Button, { onClick: () => setEdit(false) }, "Cancel"),
|
|
17
|
+
React.createElement(Button, { type: "primary", onClick: async () => {
|
|
18
|
+
await store
|
|
19
|
+
.edit(props.id, { data: { Body: codeContent }, error: "message" })
|
|
20
|
+
.then(() => setEdit(false));
|
|
21
|
+
} }, "Save"))) : (React.createElement(Button, { type: "primary", onClick: () => setEdit(true) }, "Edit")))),
|
|
22
|
+
edit ? (React.createElement("div", { className: "message-template-edit-code-mirror" },
|
|
23
|
+
React.createElement(CodeMirror, { code: messageTemplate.body, onChange: (code) => setCodeContent(code) }))) : (React.createElement(Skeleton, { loading: !messageTemplate.loaded },
|
|
24
|
+
React.createElement("div", { className: "message-template-iframe-content" },
|
|
25
|
+
React.createElement("div", null,
|
|
26
|
+
React.createElement("iframe", { srcDoc: merge(messageTemplate.isLayout, messageTemplate.body, (_a = messageTemplate === null || messageTemplate === void 0 ? void 0 : messageTemplate.layout) === null || _a === void 0 ? void 0 : _a.body) })))))));
|
|
13
27
|
});
|
|
14
28
|
function merge(isLayout, body = "", layoutBody = "") {
|
|
15
|
-
return isLayout ? body : layoutBody
|
|
29
|
+
return isLayout ? body : layoutBody.replace("{{Content}}", body);
|
|
16
30
|
}
|
|
17
31
|
};
|
|
18
32
|
export default MessageTemplateContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplateContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplateContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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AK,CAAC,CAAC,CAAC;oBAC9B,CAAC,WAGO,CACF,CACR,CAAC,CAAC,CAAC,CACH,oBAAC,MAAM,IAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAE1C,CACT,CACI,CACN;YACA,IAAI,CAAC,CAAC,CAAC,CACP,6BAAK,SAAS,EAAC,mCAAmC;gBACjD,oBAAC,UAAU,IAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAI,CAC/E,CACN,CAAC,CAAC,CAAC,CACH,oBAAC,QAAQ,IAAC,OAAO,EAAE,CAAC,eAAe,CAAC,MAAM;gBACzC,6BAAK,SAAS,EAAC,iCAAiC;oBAC/C;wBACC,gCACC,MAAM,EAAE,KAAK,CACZ,eAAe,CAAC,QAAQ,EACxB,eAAe,CAAC,IAAI,EACpB,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,0CAAE,IAAI,CAC7B,GACA,CACG,CACD,CACI,CACX,CACI,CACN,CAAA;KAAA,CAAC,CAAC;IAEH,SAAS,KAAK,CAAC,QAAiB,EAAE,OAAe,EAAE,EAAE,aAAqB,EAAE;QAC3E,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,20 +1,59 @@
|
|
|
1
1
|
:global {
|
|
2
|
-
.message-template-
|
|
3
|
-
width: 100%;
|
|
2
|
+
.message-template-page {
|
|
4
3
|
height: 100%;
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
.message-template-body-header {
|
|
8
|
+
height: 40px;
|
|
9
|
+
padding: 0 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: end;
|
|
12
|
+
|
|
13
|
+
.ant-btn {
|
|
14
|
+
height: 30px;
|
|
15
|
+
padding: 2px 15px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.message-template-iframe-content {
|
|
9
20
|
width: 100%;
|
|
10
21
|
height: 100%;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
padding-right: 15px;
|
|
23
|
+
background: #fff;
|
|
24
|
+
|
|
25
|
+
& > div {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
background: #fff;
|
|
29
|
+
position: relative;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
|
|
32
|
+
iframe {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
border: none;
|
|
36
|
+
position: absolute;
|
|
37
|
+
right: -15px;
|
|
38
|
+
top: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
overflow-x: hidden;
|
|
41
|
+
overflow-y: scroll;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.message-template-edit-code-mirror {
|
|
47
|
+
height: 100%;
|
|
48
|
+
padding: 0 20px;
|
|
49
|
+
|
|
50
|
+
.message-template-code-mirror {
|
|
51
|
+
height: 100%;
|
|
52
|
+
|
|
53
|
+
.cm-editor {
|
|
54
|
+
height: 100%;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
18
57
|
}
|
|
19
58
|
}
|
|
20
59
|
}
|
|
@@ -13,7 +13,7 @@ const MessageTemplatePropertiesView = (props) => {
|
|
|
13
13
|
React.createElement(DocumentPropertiesHeader, { id: id, documentHeaderProper: {
|
|
14
14
|
toolBarProps: { closeAside: true, close: true, onReload: onReload },
|
|
15
15
|
} }),
|
|
16
|
-
React.createElement(MessageTemplateTabs, { id: id })))))));
|
|
16
|
+
React.createElement(MessageTemplateTabs, { id: id, properties: true })))))));
|
|
17
17
|
/** reload data */
|
|
18
18
|
function onReload() {
|
|
19
19
|
setLoaded(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplatePropertiesView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACN,WAAW,EACX,eAAe,GACf,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,wBAAwB,MAAM,iDAAiD,CAAC;AACvF,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,cAAc,CAAC;AAEtB,MAAM,6BAA6B,GAAG,CAAC,KAAwC,EAAE,EAAE;IAClF,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE3C,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI;QAChC,6BAAK,SAAS,EAAC,oBAAoB,IACjC,MAAM,IAAI,CACV,oBAAC,KAAK,CAAC,QAAQ;YACd,oBAAC,wBAAwB,IACxB,EAAE,EAAE,EAAE,EACN,oBAAoB,EAAE;oBACrB,YAAY,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;iBACnE,GACA;YACF,oBAAC,mBAAmB,IAAC,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplatePropertiesView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACN,WAAW,EACX,eAAe,GACf,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,wBAAwB,MAAM,iDAAiD,CAAC;AACvF,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,cAAc,CAAC;AAEtB,MAAM,6BAA6B,GAAG,CAAC,KAAwC,EAAE,EAAE;IAClF,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE3C,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI;QAChC,6BAAK,SAAS,EAAC,oBAAoB,IACjC,MAAM,IAAI,CACV,oBAAC,KAAK,CAAC,QAAQ;YACd,oBAAC,wBAAwB,IACxB,EAAE,EAAE,EAAE,EACN,oBAAoB,EAAE;oBACrB,YAAY,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;iBACnE,GACA;YACF,oBAAC,mBAAmB,IAAC,EAAE,EAAE,EAAE,EAAE,UAAU,SAAG,CAC1B,CACjB,CACI,CACgB,CACvB,CAAC,CAAC;IAEH,kBAAkB;IAClB,SAAS,QAAQ;QAChB,SAAS,CAAC,KAAK,CAAC,CAAC;QACjB,UAAU,CAAC,GAAG,EAAE;YACf,SAAS,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,EAAE,GAAG,CAAC,CAAC;IACT,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Badge } from "antd";
|
|
3
3
|
import { observe } from "@voplus/morpho-ui";
|
|
4
4
|
import { useDocumentListEffect } from "@voplus/morpho-document-core";
|
|
5
|
-
import { SendFormContext, SendFormContextData, } from "@voplus/morpho-document-core/es/data/context/SendFormContext";
|
|
6
5
|
import ActivityLog from "@voplus/morpho-org/es/components/ActivityLog2/ActivityLog2";
|
|
7
6
|
import MessageTemplateProperties from "../MessageTemplateProperties";
|
|
8
7
|
import DocumentList from "../../../../components/DocumentList";
|
|
@@ -10,25 +9,19 @@ import DocumentTabs from "../../../../components/DocumentTabs";
|
|
|
10
9
|
import MessageTemplateContent from "../MessageTemplateContent";
|
|
11
10
|
import Links from "../../../../components/Links";
|
|
12
11
|
const MessageTemplateTabs = (props) => {
|
|
13
|
-
const { id } = props;
|
|
12
|
+
const { id, templateCanEdit } = props;
|
|
14
13
|
const [docTotals, setDocTotals] = useState(0);
|
|
15
14
|
const [activeKey, setActiveKey] = useState();
|
|
16
|
-
const openType = useMemo(() => new SendFormContextData("Dialog"), []);
|
|
17
15
|
useDocumentListEffect(null, (result, total) => setDocTotals(total || 0), {
|
|
18
16
|
Total: true,
|
|
19
17
|
List: false,
|
|
20
18
|
Filters: [{ c: "ParentNodeId", o: "=", l: "And", v1: id }],
|
|
21
19
|
});
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
key: "Properties",
|
|
25
|
-
label: "Properties",
|
|
26
|
-
children: React.createElement(MessageTemplateProperties, { id: id }),
|
|
27
|
-
},
|
|
20
|
+
let items = [
|
|
28
21
|
{
|
|
29
22
|
key: "Content",
|
|
30
|
-
label: "Content Preview",
|
|
31
|
-
children: React.createElement(MessageTemplateContent, { id: id }),
|
|
23
|
+
label: templateCanEdit ? "Template Content" : "Content Preview",
|
|
24
|
+
children: React.createElement(MessageTemplateContent, { id: id, canEdit: templateCanEdit }),
|
|
32
25
|
},
|
|
33
26
|
{
|
|
34
27
|
key: "Document",
|
|
@@ -48,8 +41,13 @@ const MessageTemplateTabs = (props) => {
|
|
|
48
41
|
children: React.createElement(Links, { id: id, isTitle: false }),
|
|
49
42
|
},
|
|
50
43
|
];
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
props.properties &&
|
|
45
|
+
items.unshift({
|
|
46
|
+
key: "Properties",
|
|
47
|
+
label: "Properties",
|
|
48
|
+
children: React.createElement(MessageTemplateProperties, { id: id }),
|
|
49
|
+
});
|
|
50
|
+
return observe(() => (React.createElement(DocumentTabs, { id: id, active: "Content", tabItems: items, onChange: (key) => setActiveKey(key) })));
|
|
53
51
|
};
|
|
54
52
|
export default MessageTemplateTabs;
|
|
55
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplateTabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/components/MessageTemplateTabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,WAAW,MAAM,4DAA4D,CAAC;AACrF,OAAO,yBAAyB,MAAM,8BAA8B,CAAC;AACrE,OAAO,YAAY,MAAM,q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Y;YACjB,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,0CAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,oBAAC,WAAW,IAAC,EAAE,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI,CAAI;SAC5E;QACD;YACC,GAAG,EAAE,OAAO;YACZ,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,oBAAC,KAAK,IAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,GAAI;SAC3C;KACD,CAAC;IAEF,KAAK,CAAC,UAAU;QACf,KAAK,CAAC,OAAO,CAAC;YACb,GAAG,EAAE,YAAY;YACjB,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,oBAAC,yBAAyB,IAAC,EAAE,EAAE,EAAE,GAAI;SAC/C,CAAC,CAAC;IAEJ,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,oBAAC,YAAY,IACZ,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,KAAK,EACf,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GACnC,CACF,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,41 +1,23 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Space, Button } from "antd";
|
|
3
2
|
import { TabItemContext, TabItemStore } from "@voplus/morpho-data";
|
|
4
3
|
import { observe, useAsideContentContext } from "@voplus/morpho-ui";
|
|
5
|
-
import { useMessageTemplate, useMessageTemplateStore } from "../../../../data/message-template";
|
|
6
4
|
import { useFrame } from "../../../../components/ViewFrame/ViewFrameContext";
|
|
7
|
-
import MessageTemplateContent from "../../components/MessageTemplateContent";
|
|
8
5
|
import AsideContent from "@voplus/morpho-ui/es/components/layout/AsideContent";
|
|
9
6
|
import MainContent from "@voplus/morpho-ui/es/components/layout/MainContent";
|
|
10
7
|
import MessageTemplateProperties from "../../components/MessageTemplateProperties";
|
|
11
|
-
import
|
|
12
|
-
import CodeMirror from "../../components/CodeMirror";
|
|
8
|
+
import MessageTemplateTabs from "../../components/MessageTemplateTabs";
|
|
13
9
|
import styles from "./index.less";
|
|
14
10
|
/** The MessageTemplate Page component with router parameters support. */
|
|
15
11
|
const MessageTemplateDefaultView = ({ id }) => {
|
|
16
12
|
const context = new TabItemStore({ url: "" });
|
|
17
13
|
const frame = useFrame();
|
|
18
|
-
const messageTemplate = useMessageTemplate(id, { reload: true, includes: "layout,tags" });
|
|
19
|
-
const store = useMessageTemplateStore();
|
|
20
|
-
const [edit, setEdit] = useState(false);
|
|
21
|
-
const [codeContent, setCodeContent] = useState();
|
|
22
14
|
const [asideContext] = useState(frame ? useAsideContentContext() : AsideContent.createContext());
|
|
23
15
|
return observe(() => (React.createElement(TabItemContext.Provider, { value: context },
|
|
24
16
|
React.createElement(MainContent, { className: styles["message-template-default-view"], asideable: !frame },
|
|
25
17
|
React.createElement(MainContent.Nav, { collapsible: true },
|
|
26
18
|
React.createElement(MessageTemplateProperties, { id: id, headerVisible: true })),
|
|
27
|
-
React.createElement("div", { className: "message-template-context" },
|
|
28
|
-
React.createElement(
|
|
29
|
-
React.createElement("div", { className: "message-template-body-header" }, edit ? (React.createElement(Space, null,
|
|
30
|
-
React.createElement(Button, { onClick: () => setEdit(false) }, "Cancel"),
|
|
31
|
-
React.createElement(Button, { type: "primary", onClick: async () => {
|
|
32
|
-
await store
|
|
33
|
-
.edit(id, { data: { Body: codeContent }, error: "message" })
|
|
34
|
-
.then(() => setEdit(false));
|
|
35
|
-
} }, "Save"))) : (React.createElement(Button, { type: "primary", onClick: () => setEdit(true) }, "Edit"))),
|
|
36
|
-
edit ? (React.createElement(CodeMirror, { code: messageTemplate.body, onChange: (code) => setCodeContent(code) })) : (React.createElement(MessageTemplateContent, { id: id }))),
|
|
37
|
-
frame ? (React.createElement(DocumentTabs, { id: id, active: "Document" })) : (React.createElement(AsideContent, { className: "message-template-aside-content", context: asideContext },
|
|
38
|
-
React.createElement(DocumentTabs, { id: id, active: "Document" }))))))));
|
|
19
|
+
React.createElement("div", { className: "message-template-context" }, frame ? (React.createElement(MessageTemplateTabs, { id: id, templateCanEdit: true })) : (React.createElement(AsideContent, { context: asideContext },
|
|
20
|
+
React.createElement(MessageTemplateTabs, { id: id, templateCanEdit: true }))))))));
|
|
39
21
|
};
|
|
40
22
|
export default MessageTemplateDefaultView;
|
|
41
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/pages/MessageTemplateDefaultView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/message-template/pages/MessageTemplateDefaultView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,YAAY,MAAM,qDAAqD,CAAC;AAC/E,OAAO,WAAW,MAAM,oDAAoD,CAAC;AAC7E,OAAO,yBAAyB,MAAM,4CAA4C,CAAC;AACnF,OAAO,mBAAmB,MAAM,sCAAsC,CAAC;AACvE,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,yEAAyE;AACzE,MAAM,0BAA0B,GAAG,CAAC,EAAE,EAAE,EAAkB,EAAE,EAAE;IAC7D,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;IAEjG,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;QACtC,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,+BAA+B,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK;YACjF,oBAAC,WAAW,CAAC,GAAG,IAAC,WAAW;gBAC3B,oBAAC,yBAAyB,IAAC,EAAE,EAAE,EAAE,EAAE,aAAa,SAAG,CAClC;YAClB,6BAAK,SAAS,EAAC,0BAA0B,IACvC,KAAK,CAAC,CAAC,CAAC,CACR,oBAAC,mBAAmB,IAAC,EAAE,EAAE,EAAE,EAAE,eAAe,SAAG,CAC/C,CAAC,CAAC,CAAC,CACH,oBAAC,YAAY,IAAC,OAAO,EAAE,YAAmB;gBACzC,oBAAC,mBAAmB,IAAC,EAAE,EAAE,EAAE,EAAE,eAAe,SAAG,CACjC,CACf,CACI,CACO,CACW,CAC1B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -3,43 +3,16 @@
|
|
|
3
3
|
.main-content-nav {
|
|
4
4
|
width: 370px;
|
|
5
5
|
padding: 0;
|
|
6
|
-
z-index: 2;
|
|
7
6
|
}
|
|
7
|
+
|
|
8
8
|
.message-template-context {
|
|
9
9
|
display: flex;
|
|
10
10
|
padding: 0;
|
|
11
11
|
background: #ffffff;
|
|
12
|
-
> .message-template-aside-content,
|
|
13
|
-
> .ant-tabs {
|
|
14
|
-
flex: 1;
|
|
15
|
-
}
|
|
16
|
-
.message-template-body {
|
|
17
|
-
width: 50%;
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
border-right: 1px solid #e6e6e6;
|
|
20
|
-
|
|
21
|
-
.message-template-body-header {
|
|
22
|
-
height: 49px;
|
|
23
|
-
padding: 0 20px;
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
border-bottom: 1px solid #e6e6e6;
|
|
26
12
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.message-template-iframe-content {
|
|
33
|
-
height: calc(100% - 50px);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.message-template-code-mirror {
|
|
37
|
-
height: calc(100% - 50px);
|
|
38
|
-
|
|
39
|
-
.cm-editor {
|
|
40
|
-
height: 100%;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
13
|
+
> div {
|
|
14
|
+
flex: 1;
|
|
15
|
+
width: 100%;
|
|
43
16
|
}
|
|
44
17
|
}
|
|
45
18
|
}
|