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
3ab11020
Commit
3ab11020
authored
Jan 12, 2024
by
ramdayalmunda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
font size element added
parent
0e974ad6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
a-doc-editor2.css
dist/assets/a-doc-editor2.css
+6
-0
a-doc-editor2.js
dist/assets/a-doc-editor2.js
+32
-6
No files found.
dist/assets/a-doc-editor2.css
View file @
3ab11020
...
...
@@ -55,6 +55,12 @@
[
adc-type
=
"popover"
]
{
pointer-events
:
none
;
}
.small-input
{
width
:
50px
;
}
.small-btn
{
width
:
25px
;
}
.option
{
border
:
1px
solid
black
;
padding
:
5px
;
...
...
dist/assets/a-doc-editor2.js
View file @
3ab11020
...
...
@@ -69,6 +69,11 @@ var ADocEditor = function (customConfig) {
<div class="option" adc-toggle="listing-option" value="0">1. Numbers</div>
</div>
</div>
<div class="item">
<button adc="font-size-change" class="small-btn" value="-1">-</button>
<input type="number" adc="font-size-input" class="small-input">
<button adc="font-size-change" class="small-btn" value="+1">+</button>
</div>
</div>
</div>
<div class="page-list" adc="page-list"></div>
...
...
@@ -170,6 +175,28 @@ var ADocEditor = function (customConfig) {
}
})()
!
(
function
fontSizeHandler
(){
let
fontSizeInput
=
shadow
.
querySelector
(
'[adc="font-size-input"]'
)
fontSizeInput
.
value
=
caretData
.
style
.
fontSize
let
fontSizeChangers
=
shadow
.
querySelectorAll
(
'[adc="font-size-change"]'
)
fontSizeChangers
.
forEach
(
btn
=>
{
btn
.
addEventListener
(
'click'
,(
e
)
=>
{
let
change
=
Number
(
e
.
target
.
getAttribute
(
'value'
))
change
=
change
?
change
:
0
change
=
caretData
.
style
.
fontSize
+
change
change
=
change
?
change
:
config
.
style
.
fontSize
caretData
.
style
.
fontSize
=
change
fontSizeInput
.
value
=
change
}
)
}
)
fontSizeInput
.
addEventListener
(
'input'
,
(
e
)
=>
{
let
value
=
Number
(
e
.
target
.
value
)
value
=
value
?
value
:
config
.
style
.
fontSize
caretData
.
style
.
fontSize
=
value
})
})()
reConfigure
(
customConfig
)
reRenderCanvas
()
addGlobalEvents
()
...
...
@@ -618,15 +645,14 @@ var ADocEditor = function (customConfig) {
function mousedownHandler(e) {
if (focussedPage) {
const rect = e.target.getBoundingClientRect(); // Get the position of the canvas
// const x = e.clientX - rect.left; // Adjusted X coordinate
// const y = e.clientY - rect.top; // Adjusted Y coordinate
// const width = Math.round(rect.width)
// const height = Math.round(rect.height)
const pxX = (e.clientX - rect.left) * config.pageSetup.pxWidth / rect.width;
const pxY = (e.clientY - rect.top) * config.pageSetup.pxHeight / rect.height;
placeCaret({ x: pxX, y: pxY })
let style = caretData.activeData.formatedText[caretData.index]
if (style) caretData.style = { ...caretData.style,
fontSize: style.fontSize,
}
shadow.querySelector('[adc="font-size-input"]').value = caretData.style.fontSize
}
}
function onFocusHandler(e) {
...
...
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