From 8ef894f8996386e0db3a3986527dd9da8c1d5cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Fri, 27 Sep 2019 11:35:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F;switch=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81=E6=96=87=E5=AD=97;md?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=BC=80=E5=A7=8B=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/marked.css | 1 + src/css/marked.scss | 2 +- src/form/checkbox.wc | 3 +- src/form/input.wc | 1 + src/form/radio.wc | 3 +- src/form/select.wc | 1 + src/form/switch.wc | 16 ++ src/markdown/index.wc | 188 ++++++++++++++++++ src/marked/index.js | 2 +- src/meditor/index.wc | 23 +++ .../addon/attach-native.js | 0 src/{meditor => meditor2}/addon/attach.js | 0 src/{meditor => meditor2}/addon/base.js | 0 src/{meditor => meditor2}/index.js | 0 14 files changed, 236 insertions(+), 4 deletions(-) create mode 100644 src/css/marked.css create mode 100644 src/markdown/index.wc create mode 100644 src/meditor/index.wc rename src/{meditor => meditor2}/addon/attach-native.js (100%) rename src/{meditor => meditor2}/addon/attach.js (100%) rename src/{meditor => meditor2}/addon/base.js (100%) rename src/{meditor => meditor2}/index.js (100%) diff --git a/src/css/marked.css b/src/css/marked.css new file mode 100644 index 0000000..c0b6d07 --- /dev/null +++ b/src/css/marked.css @@ -0,0 +1 @@ +.do-marked-theme,.do-marked-theme-gfm,.do-marked-theme-vue{position:relative;line-height:1.5;font-size:13px;color:#62778d}.do-marked-theme a,.do-marked-theme-gfm a,.do-marked-theme-vue a{text-decoration:underline;color:#409eff}.do-marked-theme a:hover,.do-marked-theme-gfm a:hover,.do-marked-theme-vue a:hover{color:#66b1ff;text-decoration:none}.do-marked-theme em,.do-marked-theme-gfm em,.do-marked-theme-vue em{color:#7e909a}.do-marked-theme strong,.do-marked-theme-gfm strong,.do-marked-theme-vue strong{color:#425064}.do-marked-theme em,.do-marked-theme strong,.do-marked-theme del,.do-marked-theme-gfm em,.do-marked-theme-gfm strong,.do-marked-theme-gfm del,.do-marked-theme-vue em,.do-marked-theme-vue strong,.do-marked-theme-vue del{padding:0 3px}.do-marked-theme p,.do-marked-theme-gfm p,.do-marked-theme-vue p{margin:15px 0}.do-marked-theme img,.do-marked-theme-gfm img,.do-marked-theme-vue img{max-width:100%}.do-marked-theme blockquote.md-quote,.do-marked-theme-gfm blockquote.md-quote,.do-marked-theme-vue blockquote.md-quote{margin:10px 0;padding:5px 10px;border-left:5px solid #dae1e9;background:#f3f5fb;color:#aabac3}.do-marked-theme blockquote.md-quote p,.do-marked-theme-gfm blockquote.md-quote p,.do-marked-theme-vue blockquote.md-quote p{margin:0}.do-marked-theme .md-warn,.do-marked-theme .md-mark,.do-marked-theme-gfm .md-warn,.do-marked-theme-gfm .md-mark,.do-marked-theme-vue .md-warn,.do-marked-theme-vue .md-mark{display:inline-block;position:relative;min-height:35px;margin:3px 0;padding:3px 8px 3px 35px;line-height:27px;border:1px solid #f39c12;border-radius:5px;background:#fffbed;color:#e67e22;word-break:break-all}.do-marked-theme .md-warn p,.do-marked-theme .md-mark p,.do-marked-theme-gfm .md-warn p,.do-marked-theme-gfm .md-mark p,.do-marked-theme-vue .md-warn p,.do-marked-theme-vue .md-mark p{margin:0 !important}.do-marked-theme .md-warn i,.do-marked-theme .md-mark i,.do-marked-theme-gfm .md-warn i,.do-marked-theme-gfm .md-mark i,.do-marked-theme-vue .md-warn i,.do-marked-theme-vue .md-mark i{position:absolute;left:8px;top:6px;line-height:1;font-size:20px;color:#eb3b48}.do-marked-theme .md-mark,.do-marked-theme-gfm .md-mark,.do-marked-theme-vue .md-mark{border-color:#3fc2a7;color:#16967a;background:#edfbf8}.do-marked-theme .md-mark i,.do-marked-theme-gfm .md-mark i,.do-marked-theme-vue .md-mark i{color:#16967a}.do-marked-theme .md-task,.do-marked-theme-gfm .md-task,.do-marked-theme-vue .md-task{position:relative;display:inline-block;width:auto;height:30px;padding-right:10px;line-height:30px;text-align:center;cursor:default}.do-marked-theme .md-task__box,.do-marked-theme-gfm .md-task__box,.do-marked-theme-vue .md-task__box{float:left;width:18px;height:18px;margin:6px;margin-left:0;line-height:1;border:1px solid #aabac3;border-radius:3px;font-size:16px;text-align:center}.do-marked-theme .md-task.done .md-task__box,.do-marked-theme-gfm .md-task.done .md-task__box,.do-marked-theme-vue .md-task.done .md-task__box{color:#aabac3;border-color:#dae1e9;background:#dae1e9}.do-marked-theme .md-task.done .md-task__text,.do-marked-theme-gfm .md-task.done .md-task__text,.do-marked-theme-vue .md-task.done .md-task__text{color:#aabac3;text-decoration:line-through}.do-marked-theme hr,.do-marked-theme-gfm hr,.do-marked-theme-vue hr{height:1px;margin:30px 0;line-height:1px;border:0;color:#aabac3;background-color:#aabac3}.do-marked-theme ol,.do-marked-theme-gfm ol,.do-marked-theme-vue ol{margin-left:1em;list-style:decimal outside none}.do-marked-theme ul,.do-marked-theme-gfm ul,.do-marked-theme-vue ul{margin-left:1em;list-style:disc outside none}.do-marked-theme li,.do-marked-theme-gfm li,.do-marked-theme-vue li{margin:.5em 0}.do-marked-theme li ol,.do-marked-theme-gfm li ol,.do-marked-theme-vue li ol{margin-left:1em}.do-marked-theme li ul,.do-marked-theme-gfm li ul,.do-marked-theme-vue li ul{margin-left:1em;list-style-type:circle}.do-marked-theme li ol ul,.do-marked-theme li ul ul,.do-marked-theme-gfm li ol ul,.do-marked-theme-gfm li ul ul,.do-marked-theme-vue li ol ul,.do-marked-theme-vue li ul ul{list-style-type:square}.do-marked-theme h1,.do-marked-theme h2,.do-marked-theme h3,.do-marked-theme h4,.do-marked-theme h5,.do-marked-theme h6{position:relative;margin:15px 0;padding-left:30px;font-weight:normal;font-size:16px}.do-marked-theme h1 span,.do-marked-theme h2 span,.do-marked-theme h3 span,.do-marked-theme h4 span,.do-marked-theme h5 span,.do-marked-theme h6 span{position:relative;display:inline-block;padding:0 8px;background:#fff;color:#425064}.do-marked-theme h1 a,.do-marked-theme h2 a,.do-marked-theme h3 a,.do-marked-theme h4 a,.do-marked-theme h5 a,.do-marked-theme h6 a{padding:0 3px;font-weight:bold;text-decoration:none}.do-marked-theme h1 a:hover,.do-marked-theme h2 a:hover,.do-marked-theme h3 a:hover,.do-marked-theme h4 a:hover,.do-marked-theme h5 a:hover,.do-marked-theme h6 a:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}.do-marked-theme h1{margin:0 0 30px;padding-left:0;font-size:24px}.do-marked-theme h1:after{display:block;width:100%;content:"";border-bottom:1px solid #dae1e9}.do-marked-theme h1 span{padding-left:0}.do-marked-theme h2:before,.do-marked-theme h3:before,.do-marked-theme h4:before,.do-marked-theme h5:before,.do-marked-theme h6:before{display:block;position:absolute;left:0;top:50%;width:100%;content:"";border-bottom:1px solid #dae1e9}.do-marked-theme h2{margin:20px 0;font-size:22px}.do-marked-theme h3{margin:20px 0 15px;font-size:20px}.do-marked-theme h4{font-size:18px}.do-marked-theme table{width:100%;line-height:25px}.do-marked-theme table thead tr{height:45px;background:#f3f5fb}.do-marked-theme table thead th{padding:10px 8px;border:0}.do-marked-theme table tbody tr{height:auto;transition:all .3s ease-in-out}.do-marked-theme table tbody tr:hover{background:#fbfbfb}.do-marked-theme table tbody td{padding:9px 8px;border-bottom:1px solid #f3f5fb}.do-marked-theme-gfm h1,.do-marked-theme-gfm h2,.do-marked-theme-gfm h3,.do-marked-theme-gfm h4,.do-marked-theme-gfm h5,.do-marked-theme-gfm h6,.do-marked-theme-vue h1,.do-marked-theme-vue h2,.do-marked-theme-vue h3,.do-marked-theme-vue h4,.do-marked-theme-vue h5,.do-marked-theme-vue h6{position:relative;margin:15px 0;font-weight:normal;font-size:16px}.do-marked-theme-gfm h1 span,.do-marked-theme-gfm h2 span,.do-marked-theme-gfm h3 span,.do-marked-theme-gfm h4 span,.do-marked-theme-gfm h5 span,.do-marked-theme-gfm h6 span,.do-marked-theme-vue h1 span,.do-marked-theme-vue h2 span,.do-marked-theme-vue h3 span,.do-marked-theme-vue h4 span,.do-marked-theme-vue h5 span,.do-marked-theme-vue h6 span{position:relative;display:inline-block;padding:0 5px;color:#425064}.do-marked-theme-gfm h1 a,.do-marked-theme-gfm h2 a,.do-marked-theme-gfm h3 a,.do-marked-theme-gfm h4 a,.do-marked-theme-gfm h5 a,.do-marked-theme-gfm h6 a,.do-marked-theme-vue h1 a,.do-marked-theme-vue h2 a,.do-marked-theme-vue h3 a,.do-marked-theme-vue h4 a,.do-marked-theme-vue h5 a,.do-marked-theme-vue h6 a{visibility:hidden;position:absolute;left:-25px;width:25px;padding:0 3px;font-weight:bold;text-decoration:none;text-align:center}.do-marked-theme-gfm h1:hover a,.do-marked-theme-gfm h2:hover a,.do-marked-theme-gfm h3:hover a,.do-marked-theme-gfm h4:hover a,.do-marked-theme-gfm h5:hover a,.do-marked-theme-gfm h6:hover a,.do-marked-theme-vue h1:hover a,.do-marked-theme-vue h2:hover a,.do-marked-theme-vue h3:hover a,.do-marked-theme-vue h4:hover a,.do-marked-theme-vue h5:hover a,.do-marked-theme-vue h6:hover a{visibility:visible}.do-marked-theme-gfm h1:after,.do-marked-theme-gfm h2:after,.do-marked-theme-gfm h3:after,.do-marked-theme-gfm h4:after,.do-marked-theme-gfm h5:after,.do-marked-theme-gfm h6:after,.do-marked-theme-vue h1:after,.do-marked-theme-vue h2:after,.do-marked-theme-vue h3:after,.do-marked-theme-vue h4:after,.do-marked-theme-vue h5:after,.do-marked-theme-vue h6:after{display:block;width:100%;content:"";border-bottom:1px solid #dae1e9}.do-marked-theme-gfm h1,.do-marked-theme-vue h1{margin:0 0 30px;font-size:24px}.do-marked-theme-gfm h2,.do-marked-theme-vue h2{margin:20px 0;font-size:22px}.do-marked-theme-gfm h3,.do-marked-theme-vue h3{margin:20px 0 15px;font-size:20px}.do-marked-theme-gfm h4,.do-marked-theme-vue h4{font-size:18px}.do-marked-theme-gfm table,.do-marked-theme-vue table{border-spacing:0;border-collapse:collapse}.do-marked-theme-gfm table tr,.do-marked-theme-vue table tr{border-top:1px solid #ccc;background-color:#fff}.do-marked-theme-gfm table th,.do-marked-theme-gfm table td,.do-marked-theme-vue table th,.do-marked-theme-vue table td{padding:6px 13px;border:1px solid #ddd}.do-marked-theme-gfm table th,.do-marked-theme-vue table th{font-weight:bold}.do-marked-theme-gfm table tr:nth-child(2n),.do-marked-theme-vue table tr:nth-child(2n){background-color:#fbfbfb}.do-marked-theme-gfm{color:#425064}.do-marked-theme-gfm blockquote.md-quote{background:none}.do-marked-theme-gfm .do-ui-blockcode,.do-marked-theme-gfm .do-ui-inlinecode{border:1px solid #dae1e9}.do-marked-theme-gfm .do-ui-inlinecode{color:inherit}.do-marked-theme-vue a{color:#19b491}.do-marked-theme-vue a:hover{color:#3fc2a7}.do-marked-theme-vue blockquote.md-quote{border-color:#3fc2a7;background:#f2faf7}.do-marked-theme-vue h1,.do-marked-theme-vue h2,.do-marked-theme-vue h3,.do-marked-theme-vue h4,.do-marked-theme-vue h5,.do-marked-theme-vue h6{font-weight:bold}.do-marked-theme-vue h1 span,.do-marked-theme-vue h2 span,.do-marked-theme-vue h3 span,.do-marked-theme-vue h4 span,.do-marked-theme-vue h5 span,.do-marked-theme-vue h6 span{color:inherit}.do-marked-theme-vue h1:after,.do-marked-theme-vue h2:after,.do-marked-theme-vue h3:after,.do-marked-theme-vue h4:after,.do-marked-theme-vue h5:after,.do-marked-theme-vue h6:after{display:none}.do-marked-theme-vue table{display:table}.do-marked-theme-vue table thead tr{background:#f3f5fb}.do-marked-theme-vue .do-ui-inlinecode{color:#e67e22} diff --git a/src/css/marked.scss b/src/css/marked.scss index 84b17b8..a2c24d2 100644 --- a/src/css/marked.scss +++ b/src/css/marked.scss @@ -105,7 +105,7 @@ h3 {margin:20px 0 15px;font-size:20px;} h4 {font-size:18px;} - table {overflow:auto;width:100%;border-spacing:0;border-collapse:collapse; + table {border-spacing:0;border-collapse:collapse; tr {border-top:1px solid #ccc;background-color: #fff;} th, td {padding:6px 13px;border:1px solid #ddd;} diff --git a/src/form/checkbox.wc b/src/form/checkbox.wc index e7bf03c..c632472 100644 --- a/src/form/checkbox.wc +++ b/src/form/checkbox.wc @@ -19,8 +19,9 @@ height: 32px; padding: 0 5px; line-height: 0; - user-select: none; -moz-user-select: none; + user-select: none; + white-space: nowrap; cursor: inherit; color: nth($cgr, 3); } diff --git a/src/form/input.wc b/src/form/input.wc index 38fb734..2c98867 100644 --- a/src/form/input.wc +++ b/src/form/input.wc @@ -77,6 +77,7 @@ li { padding: 0 10px; line-height: 0; background: nth($cp, 1); + white-space: nowrap; } .prepend { border-right: 1px solid nth($cp, 3); diff --git a/src/form/radio.wc b/src/form/radio.wc index 4e793de..a790038 100644 --- a/src/form/radio.wc +++ b/src/form/radio.wc @@ -19,8 +19,9 @@ height: 32px; padding: 0 5px; line-height: 0; - user-select: none; -moz-user-select: none; + user-select: none; + white-space: nowrap; cursor: inherit; color: nth($cgr, 3); diff --git a/src/form/select.wc b/src/form/select.wc index a65378b..ad2efe3 100644 --- a/src/form/select.wc +++ b/src/form/select.wc @@ -65,6 +65,7 @@ width: auto; height: 30px; padding: 0 10px; + white-space: nowrap; background: nth($cp, 1); } .prepend { diff --git a/src/form/switch.wc b/src/form/switch.wc index 9918379..ab191d1 100644 --- a/src/form/switch.wc +++ b/src/form/switch.wc @@ -15,6 +15,7 @@ display: flex; justify-content: center; align-items: center; + white-space: nowrap; } label { display: flex; @@ -110,6 +111,8 @@ import { bind, unbind } from '../utils' export default class Switch { props = { + 'active-text': null, + 'inactive-text': null, checked: false, disabled: false } @@ -161,6 +164,15 @@ export default class Switch { return } this.checked = !this.checked + if (this.checked) { + if (this.props['active-text'] !== null) { + this.textContent = this.props['active-text'] + } + } else { + if (this.props['inactive-text'] !== null) { + this.textContent = this.props['inactive-text'] + } + } this.dispatchEvent(new CustomEvent('input')) }) } @@ -175,6 +187,10 @@ export default class Switch { case 'disabled': this[name] = true break + case 'active-text': + case 'inactive-text': + this.props[name] = val + '' + break } } } diff --git a/src/markdown/index.wc b/src/markdown/index.wc new file mode 100644 index 0000000..62e533b --- /dev/null +++ b/src/markdown/index.wc @@ -0,0 +1,188 @@ + + + + + diff --git a/src/marked/index.js b/src/marked/index.js index cb37a37..b2fb2c5 100644 --- a/src/marked/index.js +++ b/src/marked/index.js @@ -4,7 +4,7 @@ * https://github.com/chjj/marked */ -import 'css/marked.scss' +// import 'css/marked.scss' /** * Block-Level Grammar */ diff --git a/src/meditor/index.wc b/src/meditor/index.wc new file mode 100644 index 0000000..ac23562 --- /dev/null +++ b/src/meditor/index.wc @@ -0,0 +1,23 @@ + + + + + diff --git a/src/meditor/addon/attach-native.js b/src/meditor2/addon/attach-native.js similarity index 100% rename from src/meditor/addon/attach-native.js rename to src/meditor2/addon/attach-native.js diff --git a/src/meditor/addon/attach.js b/src/meditor2/addon/attach.js similarity index 100% rename from src/meditor/addon/attach.js rename to src/meditor2/addon/attach.js diff --git a/src/meditor/addon/base.js b/src/meditor2/addon/base.js similarity index 100% rename from src/meditor/addon/base.js rename to src/meditor2/addon/base.js diff --git a/src/meditor/index.js b/src/meditor2/index.js similarity index 100% rename from src/meditor/index.js rename to src/meditor2/index.js