Skip to content

Commit

Permalink
fix some textarea problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ianho committed Aug 10, 2018
1 parent c7a3562 commit 909ae06
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
xing-weapp-editor
# xing-weapp-editor

> 开箱即用的小程序图文编辑组件
2 changes: 0 additions & 2 deletions fragment/components/xing-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Component({
windowHeight: 0,
nodeList: [],
textBufferPool: [],
textareaFocus: null,
},

attached: function () {
Expand Down Expand Up @@ -107,7 +106,6 @@ Component({
this.setData({
nodeList,
textBufferPool,
textareaFocus: index + 1,
})
},

Expand Down
12 changes: 7 additions & 5 deletions fragment/components/xing-editor.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--components/xing-editor.wxml-->
<scroll-view
<view
class="editor-wrapper"
style="height: {{windowHeight - 50}}px"
style="min-height: {{windowHeight}}px"
scroll-y
enable-back-to-top>
<view class="editor-add-wrapper">
Expand All @@ -16,7 +16,6 @@
value="{{node.children[0].text}}"
auto-height
maxlength="-1"
focus="{{index === textareaFocus}}"
data-index="{{index}}"
bindinput="onTextareaInput">
</textarea>
Expand All @@ -31,5 +30,8 @@
<view class="editor-add iconfont icon-image" data-index="{{index}}" bindtap="addImage"></view>
</view>
</block>
</scroll-view>
<button class="editor-submit-btn" style="background-color: {{buttonBackgroundColor}}; color: {{buttonTextColor}}" bindtap="onFinish">完成</button>
<button
class="editor-submit-btn"
style="background-color: {{buttonBackgroundColor}}; color: {{buttonTextColor}}"
bindtap="onFinish">完成</button>
</view>
16 changes: 5 additions & 11 deletions fragment/components/xing-editor.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,21 @@
.icon-plus:before { content: "\e7fe"; }

.editor-wrapper {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
background: #F2F6FC;
z-index: 999;
padding: 20rpx;
box-sizing: border-box;
}

.editor-submit-btn {
position: fixed;
bottom: 0;
left: 0;
width: 750rpx;
width: 700rpx;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
border-radius: 0;
z-index: 999;
box-shadow: 0 -3rpx 8rpx rgba(0, 0, 0, .3);
margin-top: 20rpx;
border-radius: 10rpx;
}

.editor-submit-btn::before, .editor-submit-btn::after {
Expand Down

0 comments on commit 909ae06

Please sign in to comment.