Skip to content

Commit ee1a81a

Browse files
fix bug and update readme
1 parent 6bb1183 commit ee1a81a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

modules/CodeSelector/CodeSelector.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ export class CodeSelector {
5656
cur = new CodeSelectBlock(item.offsetTop, item.offsetLeft, item.offsetWidth, this.languages)
5757
this.codeSelectList.splice(i, 0, cur)
5858
if (flag === 'inhriet') {
59-
this.codeSelectList[i].getElementsByTagName('input')[0].value=this.codeSelectList[i-1].getElementsByTagName('input')[0].value
59+
this.codeSelectList[i].getElementsByTagName('input')[0].value = this.codeSelectList[i - 1].getElementsByTagName('input')[0].value
60+
this.container.insertBefore(cur,this.codeSelectList[i+1])
61+
62+
} else {
63+
this.container.appendChild(cur)
6064
}
61-
this.container.appendChild(cur)
65+
6266
break
6367
}
6468
}
@@ -106,7 +110,7 @@ class CodeSelectBlock {
106110
'left': '0',
107111
'width': '100px',
108112
'border': 'none',
109-
})
113+
}, 'code-type-input')
110114
this.button = this.itemConstructor('button', {
111115
'position': 'absolute',
112116
'outline': 'none',

modules/CodeSelector/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ var quill = new Quill('#editor-container', {
2121
);
2222

2323
```
24+
# how to get the code type
25+
the easy wat to get the code type list
26+
```javascript
27+
let list =document.getElementById('yourcodeContainer').getElementsByClassName('code-type-input')
28+
let result =Array.prototype.map.call(list,(item)=>{
29+
return item.value
30+
})
31+
```
2432
## if you wnat to use it in vue-quill-editor ,you need to modified it in the init options
2533
2634

0 commit comments

Comments
 (0)