Skip to content

Commit

Permalink
fixed issue with linenumbers and no display of line numners
Browse files Browse the repository at this point in the history
  • Loading branch information
calumk committed Jan 28, 2024
1 parent 9e1409b commit 1ab71b4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/codecup.bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
width: 800px;
padding:20px;
}

/*
#cf_holder{
overflow: hidden;
border : 1px solid #EAEEFB;
border-radius: 4px;
position: relative;
}
} */

button {
background-color: #fff;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calumk/codecup",
"version": "1.9.1",
"version": "1.9.2",
"description": "A micro code-editor for awesome web pages",
"main": "dist/codecup.bundle.js",
"files": [
Expand Down
9 changes: 6 additions & 3 deletions src/codecup.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ export default class codecup {
}

this.elLineNumbers.innerHTML = numberList

}

console.log(this.opts)

// limit the number of lines between max and min line numbers.
updateEditorHeight () {
let maxLineNumber = this.opts.maxLines
let minLineNumber = this.opts.minLines
let limitedLineNumber = this.lineNumber
Expand All @@ -218,6 +218,7 @@ export default class codecup {
this.elWrapper.style.height = (limitedLineNumber*20) + 20 + 'px'
}


listenTextarea () {
this.elTextarea.addEventListener('input', this.events._input = (e) => {
// console.log()
Expand Down Expand Up @@ -370,6 +371,7 @@ export default class codecup {
if (this.opts.lineNumbers) {
this.updateLineNumbersCount()
}
this.updateEditorHeight()
}

handleNewLineIndentation (e) {
Expand Down Expand Up @@ -397,6 +399,7 @@ export default class codecup {
input.selectionEnd = selStartPos + indent + 1

this.updateCode(input.value)
this.updateEditorHeight()
}

closeCharacter (char) {
Expand Down
4 changes: 4 additions & 0 deletions src/styles/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ const LINE_NUMBER_WIDTH = '40px'


export const editorCss = `
.codecup {
width: 100%;
height: 100%;
overflow: hidden;
border : 1px solid #EAEEFB;
border-radius: 4px;
position: relative;
}
.codecup, .codecup * {
Expand Down

0 comments on commit 1ab71b4

Please sign in to comment.