@cloudbase/weda-ui-mp 3.15.3 → 3.15.6

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.
@@ -0,0 +1,26 @@
1
+ Component({
2
+ options: {
3
+ virtualHost: true,
4
+ },
5
+ data: {
6
+ },
7
+ properties: {
8
+ dataClipboardText: {
9
+ type: String,
10
+ value: '',
11
+ },
12
+ },
13
+ methods: {
14
+ // 复制到剪贴板
15
+ copyClipBoard: function () {
16
+ wx.setClipboardData({
17
+ data: this.data.dataClipboardText,
18
+ success() {
19
+ wx.getClipboardData({
20
+ success() {},
21
+ });
22
+ },
23
+ });
24
+ },
25
+ },
26
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared",
4
+ "usingComponents": {
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ <view class="markdown-it-code-copy" bindtap="copyClipBoard"></view>
@@ -0,0 +1,49 @@
1
+ @font-face {
2
+ font-family: WdTd;
3
+ src: url("t.eot"), url("t_iefix.eot") format("embedded-opentype"),
4
+ url("t.woff") format("woff"), url("t.ttf") format("truetype"),
5
+ url("t.svg") format("svg"),
6
+ url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.eot"),
7
+ url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t_iefix.eot")
8
+ format("embedded-opentype"),
9
+ url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.woff")
10
+ format("woff"),
11
+ url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.ttf")
12
+ format("truetype"),
13
+ url("https://comp-public-replace-1303824488-cos.weda.tencent.com/icon/0.0.7/t.svg")
14
+ format("svg");
15
+ font-weight: 400;
16
+ font-style: normal;
17
+ }
18
+ .wd-markdown {
19
+ padding: 1rem;
20
+ }
21
+ .markdown-it-code-wrap {
22
+ position: relative;
23
+ }
24
+ .markdown-it-code-copy {
25
+ font-family: WdTd !important;
26
+ vertical-align: middle;
27
+ font-size: 14px;
28
+ border: none;
29
+ background: transparent;
30
+ position: absolute; top: 7.5px; right: 6px; cursor: pointer; outline: none;
31
+ }
32
+ i.markdown-it-code-copy {
33
+ font-style: normal;
34
+ }
35
+ .markdown-it-code-copy::before {
36
+ content: '\E1AC';
37
+ position: absolute;
38
+ top: 0;
39
+ right: 0;
40
+ cursor: pointer;
41
+ width: 20px;
42
+ height: 20px;
43
+ display: inline-block;
44
+ text-align: center;
45
+ }
46
+ .markdown-it-code-copy:hover::before {
47
+ background: #eef1f4;
48
+ }
49
+
@@ -32,10 +32,7 @@ Component({
32
32
  });
33
33
  if (fileList && fileList[0] && fileList[0].tempFileURL) {
34
34
  this.setData({
35
- originValue: this.data.originValue.replace(
36
- new RegExp(url, 'g'),
37
- fileList[0].tempFileURL
38
- ),
35
+ originValue: this.data.originValue.replace(new RegExp(url, 'g'), fileList[0].tempFileURL),
39
36
  });
40
37
  }
41
38
  }
@@ -50,7 +47,7 @@ Component({
50
47
  .replace(/<table/g, `<table class="table" `)
51
48
  .replace(/<th/g, `<th class="th" `)
52
49
  .replace(/<td/g, `<td class="td" `)
53
- .replace(/<p/g, `<p class="p" `);
50
+ .replace(/<p>/g, `<p class="p"> `);
54
51
  this.setData({ originValue: initValue });
55
52
 
56
53
  try {
@@ -70,7 +67,7 @@ Component({
70
67
  await Promise.all(
71
68
  imgs.map(async (img) => {
72
69
  await this.getSrc(img, regex);
73
- })
70
+ }),
74
71
  );
75
72
  if (initValue !== this.data.originValue) {
76
73
  this.setData({ __html: this.data.originValue });
@@ -2,6 +2,7 @@
2
2
  "component": true,
3
3
  "usingComponents": {
4
4
  "node": "./node",
5
- "wd-unified-link": "../../../wd-unified-link/index"
5
+ "wd-unified-link": "../../../wd-unified-link/index",
6
+ "copy":"../../copy"
6
7
  }
7
8
  }
@@ -26,12 +26,20 @@
26
26
  <!-- <view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"> -->
27
27
  <view wx:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline-block;{{n.attrs.style}}" data-i="{{i}}">
28
28
  <!-- <node childs="{{n.children}}" opts="{{opts}}" style="display:inherit" /> -->
29
+ <block wx:if="{{n.attrs.class==='__preCodeCopyWrap'}}">
30
+ <copy dataClipboardText="{{n.attrs.href}}"></copy>
31
+ </block>
32
+ <block wx:else >
29
33
  <wd-unified-link url="{{n.attrs.href}}" options="{{n.attrs.options}}">
30
34
  <node childs="{{n.children}}" opts="{{opts}}" style="display: inherit" />
31
35
  </wd-unified-link>
36
+ </block>
37
+
32
38
  </view>
39
+
33
40
  <video wx:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" />
34
41
  <audio wx:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError" />
42
+
35
43
  <rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" user-select="{{opts[4]}}" nodes="{{[n]}}" />
36
44
  </template>
37
45
  <block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1">
@@ -3,7 +3,9 @@
3
3
  color: #0052d9;
4
4
  word-break: break-all;
5
5
  }
6
-
6
+ ._a.__preCodeCopyWrap{
7
+ color: inherit;
8
+ }
7
9
  ._hover {
8
10
  text-decoration: underline;
9
11
  opacity: 0.7;
@@ -20,9 +20,7 @@
20
20
  z-index: 10;
21
21
  }
22
22
  .wd-tooltip__hidden {
23
- left: -100vw;
24
- bottom: -100vh;
25
- visibility: hidden;
23
+ display: none;
26
24
  }
27
25
  .wd-tooltip__container {
28
26
  line-height: 18px;
@@ -32,9 +30,8 @@
32
30
  padding: 12px;
33
31
  white-space: nowrap;
34
32
  line-height: 18px;
35
- box-shadow: 0 6px 30px 5px rgba(0, 0, 0, 0.05),
36
- 0 16px 24px 2px rgba(0, 0, 0, 0.04), 0 8px 10px -5px rgba(0, 0, 0, 0.08),
37
- inset 0 0.5px 0 #dcdcdc, inset 0.5px 0 0 #dcdcdc, inset 0 -0.5px 0 #dcdcdc,
33
+ box-shadow: 0 6px 30px 5px rgba(0, 0, 0, 0.05), 0 16px 24px 2px rgba(0, 0, 0, 0.04),
34
+ 0 8px 10px -5px rgba(0, 0, 0, 0.08), inset 0 0.5px 0 #dcdcdc, inset 0.5px 0 0 #dcdcdc, inset 0 -0.5px 0 #dcdcdc,
38
35
  inset -0.5px 0 0 #dcdcdc;
39
36
  }
40
37
  .wd-tooltip__arrow {
@@ -260,10 +260,10 @@ Component({
260
260
  const initFormData = convertRemoteValueToFormData(datasourceType, dataSourceProfile, cleanInitValue);
261
261
  const formDetailInitValue = this._initValueFormDetail();
262
262
  const initValues = { ...formDetailInitValue, ...initFormData };
263
- this.setValue(initValues);
263
+ this.setValue(initValues, true);
264
264
  // eslint-disable-next-line rulesdir/no-timer
265
265
  setTimeout(() => {
266
- this.setValue(initValues);
266
+ this.setValue(initValues, true);
267
267
  this.setData({
268
268
  formData: initValues,
269
269
  initialValues: initValues,
@@ -2,6 +2,7 @@ import MarkdownIt from './utils/markdown-it.min.js';
2
2
  import highlight from './utils/highlight.min.js';
3
3
  import hljsJs from './utils/hljs_javascript.min.js';
4
4
  import hljsCss from './utils/hljs_css.min.js';
5
+ import { addCustomClassPlugin, copy } from './utils/adClass.js';
5
6
  Component({
6
7
  options: {
7
8
  virtualHost: true,
@@ -57,12 +58,15 @@ Component({
57
58
  },
58
59
  ...options,
59
60
  });
61
+ md.use(copy);
62
+ md.use(addCustomClassPlugin);
60
63
  this.setData({ mdInstance: md });
61
64
  this.triggerEvent('onReady', { markdownInstance: md });
62
65
  this.setData({
63
66
  __html: md.render(this.data.value),
64
67
  });
65
68
  },
69
+
66
70
  updateWidgetAPI() {
67
71
  this.setReadonlyAttributes &&
68
72
  this.setReadonlyAttributes({
@@ -1,3 +1,3 @@
1
- <view class="wd-markdown wd-mp-markdown {{className}}" style="{{style}}" id="id">
1
+ <view class="wd-markdown wd-mp-markdown markdown-body {{className}}" style="{{style}}" id="id">
2
2
  <richText value="{{__html}}" />
3
3
  </view>