Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
2c868f47
Commit
2c868f47
authored
Oct 31, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:fix tinymce bug in <keep-alive>
parent
1ae31fdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
65 deletions
+44
-65
index.vue
src/components/Tinymce/index.vue
+44
-65
No files found.
src/components/Tinymce/index.vue
View file @
2c868f47
...
@@ -52,36 +52,45 @@ export default {
...
@@ -52,36 +52,45 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
const
_this
=
this
this
.
initTinymce
()
window
.
tinymce
.
init
({
},
selector
:
`#
${
this
.
tinymceId
}
`
,
activated
()
{
height
:
this
.
height
,
this
.
initTinymce
()
body_class
:
'panel-body '
,
},
object_resizing
:
false
,
deactivated
()
{
toolbar
:
this
.
toolbar
,
this
.
destroyTinymce
()
menubar
:
this
.
menubar
,
},
plugins
:
'advlist,autolink,code,paste,textcolor, colorpicker,fullscreen,link,lists,media,wordcount, imagetools'
,
methods
:
{
end_container_on_empty_block
:
true
,
initTinymce
()
{
powerpaste_word_import
:
'clean'
,
const
_this
=
this
code_dialog_height
:
450
,
window
.
tinymce
.
init
({
code_dialog_width
:
1000
,
selector
:
`#
${
this
.
tinymceId
}
`
,
advlist_bullet_styles
:
'square'
,
height
:
this
.
height
,
advlist_number_styles
:
'default'
,
body_class
:
'panel-body '
,
block_formats
:
'普通标签=p;小标题=h2;'
,
object_resizing
:
false
,
imagetools_cors_hosts
:
[
'wpimg.wallstcn.com'
,
'wallstreetcn.com'
],
toolbar
:
this
.
toolbar
,
imagetools_toolbar
:
'watermark'
,
menubar
:
this
.
menubar
,
default_link_target
:
'_blank'
,
plugins
:
'advlist,autolink,code,paste,textcolor, colorpicker,fullscreen,link,lists,media,wordcount, imagetools'
,
link_title
:
false
,
end_container_on_empty_block
:
true
,
init_instance_callback
:
editor
=>
{
powerpaste_word_import
:
'clean'
,
if
(
_this
.
value
)
{
code_dialog_height
:
450
,
editor
.
setContent
(
_this
.
value
)
code_dialog_width
:
1000
,
advlist_bullet_styles
:
'square'
,
advlist_number_styles
:
'default'
,
imagetools_cors_hosts
:
[
'wpimg.wallstcn.com'
,
'wallstreetcn.com'
],
imagetools_toolbar
:
'watermark'
,
default_link_target
:
'_blank'
,
link_title
:
false
,
init_instance_callback
:
editor
=>
{
if
(
_this
.
value
)
{
editor
.
setContent
(
_this
.
value
)
}
_this
.
hasInit
=
true
editor
.
on
(
'NodeChange Change KeyUp'
,
()
=>
{
this
.
hasChange
=
true
this
.
$emit
(
'input'
,
editor
.
getContent
({
format
:
'raw'
}))
})
}
}
_this
.
hasInit
=
true
editor
.
on
(
'NodeChange Change KeyUp'
,
()
=>
{
this
.
hasChange
=
true
this
.
$emit
(
'input'
,
editor
.
getContent
({
format
:
'raw'
}))
})
},
// 整合七牛上传
// 整合七牛上传
// images_dataimg_filter(img) {
// images_dataimg_filter(img) {
// setTimeout(() => {
// setTimeout(() => {
...
@@ -115,41 +124,11 @@ export default {
...
@@ -115,41 +124,11 @@ export default {
// console.log(err);
// console.log(err);
// });
// });
// },
// },
setup
(
editor
)
{
})
editor
.
addButton
(
'h2'
,
{
},
title
:
'小标题'
,
// tooltip text seen on mouseover
destroyTinymce
()
{
text
:
'小标题'
,
window
.
tinymce
.
get
(
this
.
tinymceId
).
destroy
()
onclick
()
{
},
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'h2'
)
},
onPostRender
()
{
const
btn
=
this
editor
.
on
(
'init'
,
()
=>
{
editor
.
formatter
.
formatChanged
(
'h2'
,
state
=>
{
btn
.
active
(
state
)
})
})
}
})
editor
.
addButton
(
'p'
,
{
title
:
'正文'
,
text
:
'正文'
,
onclick
()
{
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'p'
)
},
onPostRender
()
{
const
btn
=
this
editor
.
on
(
'init'
,
()
=>
{
editor
.
formatter
.
formatChanged
(
'p'
,
state
=>
{
btn
.
active
(
state
)
})
})
}
})
}
})
},
methods
:
{
setContent
(
value
)
{
setContent
(
value
)
{
window
.
tinymce
.
get
(
this
.
tinymceId
).
setContent
(
value
)
window
.
tinymce
.
get
(
this
.
tinymceId
).
setContent
(
value
)
},
},
...
@@ -164,7 +143,7 @@ export default {
...
@@ -164,7 +143,7 @@ export default {
}
}
},
},
destroyed
()
{
destroyed
()
{
window
.
tinymce
.
get
(
this
.
tinymceId
).
destroy
()
this
.
destroyTinymce
()
}
}
}
}
</
script
>
</
script
>
...
...
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