Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
a-doc-editor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
a-doc-editor
Commits
e1d0ff89
Commit
e1d0ff89
authored
Jan 12, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
width and indenation fix
parent
2470d679
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+11
-8
index.js
index.js
+0
-1
No files found.
dist/assets/a-doc-editor2.js
View file @
e1d0ff89
...
@@ -252,7 +252,7 @@ var ADocEditor = function (customConfig) {
...
@@ -252,7 +252,7 @@ var ADocEditor = function (customConfig) {
// to calculate the lines
// to calculate the lines
let
tempLineWidth
=
0
;
let
tempLineWidth
=
0
;
let
maxLineWidth
=
config
.
pageSetup
.
pxWidth
-
(
config
.
format
.
margin
*
pxMmRatio
*
2
)
let
maxLineWidth
=
config
.
pageSetup
.
pxWidth
-
(
config
.
format
.
margin
*
pxMmRatio
*
2
)
let
tabWidth
=
(
(
dataBlock
.
type
==
1
?
1
:
0
)
+
dataBlock
.
tabCount
)
*
config
.
format
.
tabWidth
*
pxMmRatio
let
tabWidth
=
(
(
dataBlock
.
type
==
1
?
1
:
0
)
+
dataBlock
.
tabCount
)
*
config
.
format
.
tabWidth
*
pxMmRatio
lineObj
.
tabWidth
=
tabWidth
lineObj
.
tabWidth
=
tabWidth
maxLineWidth
-=
tabWidth
maxLineWidth
-=
tabWidth
lineObj
.
dataType
=
dataBlock
.
type
lineObj
.
dataType
=
dataBlock
.
type
...
@@ -275,9 +275,13 @@ var ADocEditor = function (customConfig) {
...
@@ -275,9 +275,13 @@ var ADocEditor = function (customConfig) {
lineObj
.
plainContent
=
dataBlock
.
plainContent
.
slice
(
lineObj
.
charStartIndex
,
lineObj
.
charEndIndex
+
1
)
lineObj
.
plainContent
=
dataBlock
.
plainContent
.
slice
(
lineObj
.
charStartIndex
,
lineObj
.
charEndIndex
+
1
)
lines
.
push
(
lineObj
)
lines
.
push
(
lineObj
)
lineObj
=
new
getLineObj
()
lineObj
=
new
getLineObj
()
lineObj
.
listIndex
=
dataBlock
.
listIndex
maxLineWidth
=
config
.
pageSetup
.
pxWidth
-
(
config
.
format
.
margin
*
pxMmRatio
*
2
)
lineObj
.
maxLineWidth
=
maxLineWidth
lineObj
.
maxLineWidth
=
maxLineWidth
lineObj
.
tabCount
=
dataBlock
.
tabCount
if
(
dataBlock
.
type
==
1
)
lineObj
.
tabWidth
=
tabWidth
else
lineObj
.
tabWidth
=
0
lineObj
.
listIndex
=
dataBlock
.
listIndex
if
(
dataBlock
.
type
==
1
)
lineObj
.
tabCount
=
dataBlock
.
tabCount
else
lineObj
.
tabCount
=
0
lineObj
.
charStartIndex
=
i
+
1
lineObj
.
charStartIndex
=
i
+
1
lineObj
.
charEndIndex
=
i
+
1
lineObj
.
charEndIndex
=
i
+
1
tempLineWidth
=
0
tempLineWidth
=
0
...
@@ -342,7 +346,6 @@ var ADocEditor = function (customConfig) {
...
@@ -342,7 +346,6 @@ var ADocEditor = function (customConfig) {
caretData.previousCaret = null
caretData.previousCaret = null
}
}
if (!caretData.blink) {
if (!caretData.blink) {
let x = config.format.margin * pxMmRatio
let x = config.format.margin * pxMmRatio
let y = (config.format.margin) * pxMmRatio
let y = (config.format.margin) * pxMmRatio
let height = config.style.fontSize * pxMmRatio * 5 / 4
let height = config.style.fontSize * pxMmRatio * 5 / 4
...
@@ -438,15 +441,14 @@ var ADocEditor = function (customConfig) {
...
@@ -438,15 +441,14 @@ var ADocEditor = function (customConfig) {
else if (e.key == 'Backspace') {
else if (e.key == 'Backspace') {
if (caretData.index == 0) {
if (caretData.index == 0) {
let activeDataIndex = dataList.findIndex(item => item.id == caretData.activeData.id)
let activeDataIndex = dataList.findIndex(item => item.id == caretData.activeData.id)
if (activeDataIndex > 0) {
if ( caretData.activeData.type == 0 ){
if (caretData.activeData.tabCount){
if (caretData.activeData.tabCount){
caretData.activeData.tabCount--
caretData.activeData.tabCount--
}else{
}
else if (activeDataIndex > 0) {
if ( caretData.activeData.type == 0 ){
if (!caretData.activeData.plainContent.length){ dataList.splice( activeDataIndex, 1 ) }
if (!caretData.activeData.plainContent.length){ dataList.splice( activeDataIndex, 1 ) }
caretData.activeData = dataList[activeDataIndex - 1]
caretData.activeData = dataList[activeDataIndex - 1]
caretData.index = caretData.activeData.plainContent.length
caretData.index = caretData.activeData.plainContent.length
}
}else if ( caretData.activeData.type==1 ){
}else if ( caretData.activeData.type==1 ){
caretData.activeData.type = 0
caretData.activeData.type = 0
}
}
...
@@ -469,6 +471,7 @@ var ADocEditor = function (customConfig) {
...
@@ -469,6 +471,7 @@ var ADocEditor = function (customConfig) {
if (e.ctrlKey || e.metaKey) dataObj.newPage = true
if (e.ctrlKey || e.metaKey) dataObj.newPage = true
caretData.index = 0
caretData.index = 0
caretData.activeData = dataObj
caretData.activeData = dataObj
if (dataObj.type==0) dataObj.tabCount = 0
dataList.push(dataObj)
dataList.push(dataObj)
}
}
else if (e.key.length == 1 && !e.ctrlKey && !e.metaKey) { // displayable text
else if (e.key.length == 1 && !e.ctrlKey && !e.metaKey) { // displayable text
...
...
index.js
View file @
e1d0ff89
const
express
=
require
(
"express"
)
const
express
=
require
(
"express"
)
const
port
=
3910
;
const
port
=
3910
;
const
path
=
require
(
"path"
);
const
path
=
require
(
"path"
);
console
.
log
(
typeof
FileReader
)
const
app
=
express
()
const
app
=
express
()
app
.
use
(
express
.
json
()
)
app
.
use
(
express
.
json
()
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment