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
4bf60c78
Commit
4bf60c78
authored
Jan 11, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
global click handlers for popup
parent
01f680e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
4 deletions
+40
-4
a-doc-editor2.css
dist/assets/a-doc-editor2.css
+19
-2
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+21
-2
No files found.
dist/assets/a-doc-editor2.css
View file @
4bf60c78
...
...
@@ -26,14 +26,31 @@
.toolbar
.item
{
position
:
relative
;
background
:
green
;
border
:
1px
solid
yelow
;
background
:
#408640
;
border
:
1px
solid
gray
;
border-radius
:
3px
;
padding-top
:
2px
;
padding-bottom
:
2px
;
padding-left
:
4px
;
padding-right
:
4px
;
margin
:
4px
;
cursor
:
pointer
;
}
.popover
{
position
:
absolute
;
padding
:
20px
;
background-color
:
gray
;
border
:
1px
solid
purple
;
opacity
:
0
;
pointer-events
:
none
;
}
.popover.show
{
opacity
:
1
;
pointer-events
:
auto
;
z-index
:
10
;
}
.toolbar
.item
:hover
{
background
:
#5fad5f
;
}
.page-list
{
...
...
dist/assets/a-doc-editor2.js
View file @
4bf60c78
...
...
@@ -57,8 +57,11 @@ var ADocEditor = function (customConfig) {
htmlStr
=
/*html*/
`
<div class="header">
<div class="toolbar">
<select class="item" adc="font-select">
</select>
<select class="item" adc="font-select"></select>
<div class="item" adc="list-handler" adc-target="list-popover">
<span>L</span>
<div class="popover" adc="list-popover" adc-type="popover"></div>
</div>
</div>
</div>
<div class="page-list"></div>
...
...
@@ -569,6 +572,22 @@ var ADocEditor = function (customConfig) {
function addGlobalEvents(e) {
shadow.querySelector('.page-list').addEventListener('wheel', onMouseWheelHandler)
shadow.addEventListener('mousedown', globalMouseDownHandler)
}
function globalMouseDownHandler(e){
var elem = e.target
var targetId = elem.getAttribute('adc-target')
if (elem.getAttribute('adc-type')=='popover') return
while(!targetId && elem){
elem = elem.parentNode
if (elem?.getAttribute?.('adc-type')=='popover') return
targetId = elem?.getAttribute?.('adc-target')
}
let allPopovers = shadow.querySelectorAll('[adc-type="popover"]')
allPopovers.forEach( item=> {
if ( item.getAttribute('adc')==targetId ) item.classList.toggle('show')
else item.classList.remove('show')
} )
}
var returnObj = {
...
...
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