Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quill-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李昊晨
quill-editor
Commits
62522c47
Commit
62522c47
authored
Jul 23, 2020
by
lihaochen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对quill做适配
parent
426460eb
Pipeline
#284
canceled with stages
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
18 deletions
+34
-18
core.js
core.js
+6
-0
quill.js
core/quill.js
+15
-5
selection.js
core/selection.js
+11
-11
clipboard.js
modules/clipboard.js
+2
-2
No files found.
core.js
View file @
62522c47
...
@@ -14,6 +14,12 @@ import Clipboard from './modules/clipboard';
...
@@ -14,6 +14,12 @@ import Clipboard from './modules/clipboard';
import
History
from
'
./modules/history
'
;
import
History
from
'
./modules/history
'
;
import
Keyboard
from
'
./modules/keyboard
'
;
import
Keyboard
from
'
./modules/keyboard
'
;
class
DividerBlot
extends
BlockEmbed
{
}
DividerBlot
.
blotName
=
'
divider
'
;
DividerBlot
.
tagName
=
'
hr
'
;
Quill
.
register
(
DividerBlot
);
Quill
.
register
({
Quill
.
register
({
'
blots/block
'
:
Block
,
'
blots/block
'
:
Block
,
'
blots/block/embed
'
:
BlockEmbed
,
'
blots/block/embed
'
:
BlockEmbed
,
...
...
core/quill.js
View file @
62522c47
...
@@ -56,7 +56,7 @@ class Quill {
...
@@ -56,7 +56,7 @@ class Quill {
}
}
}
}
constructor
(
container
,
options
=
{})
{
constructor
(
container
,
options
=
{}
,
shadowRoot
,
id
)
{
this
.
options
=
expandConfig
(
container
,
options
);
this
.
options
=
expandConfig
(
container
,
options
);
this
.
container
=
this
.
options
.
container
;
this
.
container
=
this
.
options
.
container
;
if
(
this
.
container
==
null
)
{
if
(
this
.
container
==
null
)
{
...
@@ -78,8 +78,9 @@ class Quill {
...
@@ -78,8 +78,9 @@ class Quill {
emitter
:
this
.
emitter
,
emitter
:
this
.
emitter
,
whitelist
:
this
.
options
.
formats
whitelist
:
this
.
options
.
formats
});
});
this
.
_id
=
id
this
.
editor
=
new
Editor
(
this
.
scroll
);
this
.
editor
=
new
Editor
(
this
.
scroll
);
this
.
selection
=
new
Selection
(
this
.
scroll
,
this
.
emitter
);
this
.
selection
=
new
Selection
(
this
.
scroll
,
this
.
emitter
,
shadowRoot
);
this
.
theme
=
new
this
.
options
.
theme
(
this
,
this
.
options
);
this
.
theme
=
new
this
.
options
.
theme
(
this
,
this
.
options
);
this
.
keyboard
=
this
.
theme
.
addModule
(
'
keyboard
'
);
this
.
keyboard
=
this
.
theme
.
addModule
(
'
keyboard
'
);
this
.
clipboard
=
this
.
theme
.
addModule
(
'
clipboard
'
);
this
.
clipboard
=
this
.
theme
.
addModule
(
'
clipboard
'
);
...
@@ -147,14 +148,15 @@ class Quill {
...
@@ -147,14 +148,15 @@ class Quill {
format
(
name
,
value
,
source
=
Emitter
.
sources
.
API
,
shadowRoot
=
document
)
{
format
(
name
,
value
,
source
=
Emitter
.
sources
.
API
,
shadowRoot
=
document
)
{
return
modify
.
call
(
this
,
()
=>
{
return
modify
.
call
(
this
,
()
=>
{
let
range
=
this
.
getSelection
(
true
,
shadowRoot
);
// focus = true的情况下会导致焦点回到第一个字符串前面
let
range
=
this
.
getSelection
(
false
,
shadowRoot
);
let
change
=
new
Delta
();
let
change
=
new
Delta
();
if
(
range
==
null
)
{
if
(
range
==
null
)
{
return
change
;
return
change
;
}
else
if
(
Parchment
.
query
(
name
,
Parchment
.
Scope
.
BLOCK
))
{
}
else
if
(
Parchment
.
query
(
name
,
Parchment
.
Scope
.
BLOCK
))
{
change
=
this
.
editor
.
formatLine
(
range
.
index
,
range
.
length
,
{
[
name
]:
value
});
change
=
this
.
editor
.
formatLine
(
range
.
index
,
range
.
length
,
{
[
name
]:
value
});
}
else
if
(
range
.
length
===
0
)
{
}
else
if
(
range
.
length
===
0
)
{
this
.
selection
.
format
(
name
,
value
);
this
.
selection
.
format
(
name
,
value
,
shadowRoot
);
return
change
;
return
change
;
}
else
{
}
else
{
change
=
this
.
editor
.
formatText
(
range
.
index
,
range
.
length
,
{
[
name
]:
value
});
change
=
this
.
editor
.
formatText
(
range
.
index
,
range
.
length
,
{
[
name
]:
value
});
...
@@ -239,7 +241,15 @@ class Quill {
...
@@ -239,7 +241,15 @@ class Quill {