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
0e974ad6
Commit
0e974ad6
authored
Jan 12, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
list and bullet structure completed
parent
08459ade
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
18 deletions
+32
-18
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+32
-18
No files found.
dist/assets/a-doc-editor2.js
View file @
0e974ad6
...
@@ -65,8 +65,8 @@ var ADocEditor = function (customConfig) {
...
@@ -65,8 +65,8 @@ var ADocEditor = function (customConfig) {
<div class="item" adc="list-handler" adc-target="list-popover">
<div class="item" adc="list-handler" adc-target="list-popover">
<span>L</span>
<span>L</span>
<div class="popover" adc="list-popover" adc-type="popover">
<div class="popover" adc="list-popover" adc-type="popover">
<div class="option" adc-toggle="list
-bullet
">• Bullets </div>
<div class="option" adc-toggle="list
ing-option" value="1
">• Bullets </div>
<div class="option" adc-toggle="list
-number
">1. Numbers</div>
<div class="option" adc-toggle="list
ing-option" value="0
">1. Numbers</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -148,13 +148,18 @@ var ADocEditor = function (customConfig) {
...
@@ -148,13 +148,18 @@ var ADocEditor = function (customConfig) {
})()
})()
!
(
function
handleList
()
{
!
(
function
handleList
()
{
let
toggleNumber
=
shadow
.
querySelector
(
'[adc-toggle="list-number"]'
)
let
listItems
=
shadow
.
querySelectorAll
(
'[adc-toggle="listing-option"]'
)
let
toggleBullet
=
shadow
.
querySelector
(
'[adc-toggle="list-bullet"]'
)
let
popover
=
shadow
.
querySelector
(
'[adc-type="popover"]'
)
let
popover
=
shadow
.
querySelector
(
'[adc-type="popover"]'
)
toggleNumber
.
addEventListener
(
'click'
,
(
e
)
=>
{
for
(
let
i
=
0
;
i
<
listItems
.
length
;
i
++
){
listItems
[
i
].
addEventListener
(
'click'
,
(
e
)
=>
{
let
value
=
Number
(
e
.
target
.
getAttribute
(
'value'
))
value
=
value
?
value
:
0
if
(
caretData
.
activeData
)
{
if
(
caretData
.
activeData
)
{
caretData
.
activeData
.
type
=
caretData
.
activeData
.
type
==
1
?
0
:
1
caretData
.
activeData
.
type
=
(
caretData
.
activeData
.
type
==
1
&&
caretData
.
activeData
.
listStyle
==
value
)
?
0
:
1
caretData
.
activeData
.
listStyle
=
0
if
(
caretData
.
activeData
.
type
==
1
){
caretData
.
activeData
.
listStyle
=
value
}
changeListStyle
()
caretData
.
blink
=
false
caretData
.
blink
=
false
reRenderCanvas
()
reRenderCanvas
()
popover
.
classList
.
remove
(
'show'
)
popover
.
classList
.
remove
(
'show'
)
...
@@ -162,16 +167,7 @@ var ADocEditor = function (customConfig) {
...
@@ -162,16 +167,7 @@ var ADocEditor = function (customConfig) {
}
}
})
})
toggleBullet
.
addEventListener
(
'click'
,
(
e
)
=>
{
if
(
caretData
.
activeData
)
{
caretData
.
activeData
.
type
=
caretData
.
activeData
.
type
==
1
?
0
:
1
caretData
.
activeData
.
listStyle
=
1
caretData
.
blink
=
false
reRenderCanvas
()
popover
.
classList
.
remove
(
'show'
)
focusOnPage
()
}
}
})
})()
})()
reConfigure
(
customConfig
)
reConfigure
(
customConfig
)
...
@@ -351,7 +347,6 @@ var ADocEditor = function (customConfig) {
...
@@ -351,7 +347,6 @@ var ADocEditor = function (customConfig) {
}
}
function
renderLines
()
{
function
renderLines
()
{
console
.
clear
()
let
x
=
0
,
y
=
config
.
format
.
margin
*
pxMmRatio
;
let
x
=
0
,
y
=
config
.
format
.
margin
*
pxMmRatio
;
for
(
let
l
=
0
;
l
<
lines
.
length
;
l
++
)
{
for
(
let
l
=
0
;
l
<
lines
.
length
;
l
++
)
{
let
setData
=
dataList
[
lines
[
l
].
dataIndex
]
let
setData
=
dataList
[
lines
[
l
].
dataIndex
]
...
@@ -407,7 +402,7 @@ var ADocEditor = function (customConfig) {
...
@@ -407,7 +402,7 @@ var ADocEditor = function (customConfig) {
else if (tabCount % 3 == 1) label = `
$
{
convertToLetter
(
dataList
[
dataIndex
].
listItemNumber
)}.
`
else if (tabCount % 3 == 1) label = `
$
{
convertToLetter
(
dataList
[
dataIndex
].
listItemNumber
)}.
`
else label = `
$
{
convertToRoman
(
dataList
[
dataIndex
].
listItemNumber
).
toLowerCase
()}.
`
else label = `
$
{
convertToRoman
(
dataList
[
dataIndex
].
listItemNumber
).
toLowerCase
()}.
`
}
}
else if (dataList[dataIndex].listStyle ==
0
) { // >
else if (dataList[dataIndex].listStyle ==
1
) { // >
label = `
>
`
label = `
>
`
}
}
...
@@ -504,8 +499,12 @@ var ADocEditor = function (customConfig) {
...
@@ -504,8 +499,12 @@ var ADocEditor = function (customConfig) {
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 (caretData.activeData.tabCount) {
if (caretData.activeData.tabCount) {
if (caretData.activeData.type==1){
caretData.activeData.type = 0
}else{
caretData.activeData.tabCount--
caretData.activeData.tabCount--
}
}
}
else if (activeDataIndex > 0) {
else if (activeDataIndex > 0) {
if (caretData.activeData.type == 0) {
if (caretData.activeData.type == 0) {
if (!caretData.activeData.plainContent.length) { dataList.splice(activeDataIndex, 1) }
if (!caretData.activeData.plainContent.length) { dataList.splice(activeDataIndex, 1) }
...
@@ -641,6 +640,21 @@ var ADocEditor = function (customConfig) {
...
@@ -641,6 +640,21 @@ var ADocEditor = function (customConfig) {
}
}
}
}
function changeListStyle(){
let activeDataIndex = dataList.findIndex( item => item.id == caretData.activeData.id )
let d = activeDataIndex-1
while( dataList?.[d]?.type==1){
dataList[d].listStyle = caretData.activeData.listStyle
--d
}
d = activeDataIndex+1
while(dataList?.[d]?.type==1){
dataList[d].listStyle = caretData.activeData.listStyle
++d
}
}
...
...
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