Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
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
najiu-frontend
najiu-admin-template
Commits
adffefd7
Commit
adffefd7
authored
Oct 26, 2020
by
接个吻开一枪
Committed by
GitHub
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tinymce): add line height (#58)
* feat:add lineheight Co-authored-by:
fengli
<
fengli@biaodianyun.com
>
parent
1d47d8a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
Editor.vue
src/components/Tinymce/src/Editor.vue
+4
-0
lineHeight.js
src/components/Tinymce/src/lineHeight.js
+44
-0
toolbar.ts
src/components/Tinymce/src/toolbar.ts
+1
-1
No files found.
src/components/Tinymce/src/Editor.vue
View file @
adffefd7
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
import
{
useScript
}
from
'
/@/hooks/web/useScript
'
;
import
{
useScript
}
from
'
/@/hooks/web/useScript
'
;
import
{
snowUuid
}
from
'
/@/utils/uuid
'
;
import
{
snowUuid
}
from
'
/@/utils/uuid
'
;
import
{
bindHandlers
}
from
'
./helper
'
;
import
{
bindHandlers
}
from
'
./helper
'
;
import
LineHeight
from
'
./lineHeight
'
;
const
CDN_URL
=
'
https://cdn.bootcdn.net/ajax/libs/tinymce/5.5.1
'
;
const
CDN_URL
=
'
https://cdn.bootcdn.net/ajax/libs/tinymce/5.5.1
'
;
...
@@ -69,6 +70,8 @@
...
@@ -69,6 +70,8 @@
advlist_bullet_styles
:
'
square
'
,
advlist_bullet_styles
:
'
square
'
,
advlist_number_styles
:
'
default
'
,
advlist_number_styles
:
'
default
'
,
object_resizing
:
false
,
object_resizing
:
false
,
fontsize_formats
:
'
10px 11px 12px 14px 16px 18px 20px 24px 36px 48px
'
,
lineheight_formats
:
"
1 1.5 1.75 2.0 3.0 4.0 5.0
"
,
...
options
,
...
options
,
setup
:
(
editor
:
any
)
=>
{
setup
:
(
editor
:
any
)
=>
{
editorRef
.
value
=
editor
;
editorRef
.
value
=
editor
;
...
@@ -117,6 +120,7 @@
...
@@ -117,6 +120,7 @@
}
}
function
initEditor
()
{
function
initEditor
()
{
getTinymce
().
PluginManager
.
add
(
'
lineHeight
'
,
LineHeight
(
getTinymce
()));
getTinymce
().
init
(
unref
(
initOptions
));
getTinymce
().
init
(
unref
(
initOptions
));
}
}
...
...
src/components/Tinymce/src/lineHeight.js
0 → 100644
View file @
adffefd7
const
LineHeight
=
function
(
e
)
{
e
.
PluginManager
.
add
(
'
lineheight
'
,
function
(
t
,
n
,
r
)
{
t
.
on
(
'
init
'
,
function
()
{
t
.
formatter
.
register
({
lineheight
:
{
inline
:
'
span
'
,
styles
:
{
'
line-height
'
:
'
%value
'
,
},
},
});
});
t
.
ui
.
registry
.
addMenuButton
(
'
lineheight
'
,
{
icon
:
'
lineheight
'
,
tooltip
:
'
设置行高
'
,
fetch
:
function
(
callback
)
{
var
dom
=
t
.
dom
;
var
blocks
=
t
.
selection
.
getSelectedBlocks
();
var
lhv
=
0
;
global
$1
.
each
(
blocks
,
function
(
block
)
{
if
(
lhv
==
0
)
{
lhv
=
dom
.
getStyle
(
block
,
'
line-height
'
)
?
dom
.
getStyle
(
block
,
'
line-height
'
)
:
0
;
}
});
var
items
=
lineheight_val
.
split
(
'
'
).
map
(
function
(
item
)
{
var
text
=
item
;
var
value
=
item
;
return
{
type
:
'
togglemenuitem
'
,
text
:
text
,
active
:
lhv
==
value
?
true
:
false
,
onAction
:
function
()
{
doAct
(
value
);
},
};
});
callback
(
items
);
},
});
});
e
.
PluginManager
.
requireLangPack
(
'
lineheight
'
,
'
de
'
);
};
export
default
LineHeight
;
src/components/Tinymce/src/toolbar.ts
View file @
adffefd7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// Detail list see https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
// Detail list see https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
const
toolbar
=
[
const
toolbar
=
[
'
searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample
'
,
'
fontsizeselect lineheight
searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample
'
,
'
hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen
'
,
'
hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen
'
,
];
];
...
...
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