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
HireTest
VueElementTemplate
Commits
6a8a02f8
Commit
6a8a02f8
authored
7 years ago
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine tinymce
parent
d56cd594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
index.vue
src/components/Tinymce/index.vue
+12
-12
tinymce.vue
src/views/components/tinymce.vue
+1
-1
No files found.
src/components/Tinymce/index.vue
View file @
6a8a02f8
<
template
>
<div
class=
'tinymce-container editor-container'
>
<textarea
class=
'tinymce-textarea'
:id=
"
i
d"
></textarea>
<textarea
class=
'tinymce-textarea'
:id=
"
tinymceI
d"
></textarea>
<div
class=
"editor-custom-btn-container"
>
<editorImage
color=
"#20a0ff"
class=
"editor-upload-btn"
@
successCBK=
"imageSuccessCBK"
></editorImage>
</div>
...
...
@@ -15,8 +15,7 @@ export default {
components
:
{
editorImage
},
props
:
{
id
:
{
type
:
String
,
default
:
'tinymceEditor'
type
:
String
},
value
:
{
type
:
String
,
...
...
@@ -29,12 +28,6 @@ export default {
return
[
'removeformat undo redo | bullist numlist | outdent indent | forecolor | fullscreen code'
,
'bold italic blockquote | h2 p media link | alignleft aligncenter alignright'
]
}
},
data
()
{
return
{
hasChange
:
false
,
hasInit
:
false
}
},
menubar
:
{
default
:
''
},
...
...
@@ -44,6 +37,13 @@ export default {
default
:
360
}
},
data
()
{
return
{
hasChange
:
false
,
hasInit
:
false
,
tinymceId
:
this
.
id
||
'vue-tinymce-'
+
+
new
Date
()
}
},
watch
:
{
value
(
val
)
{
if
(
!
this
.
hasChange
&&
this
.
hasInit
)
{
...
...
@@ -54,7 +54,7 @@ export default {
mounted
()
{
const
_this
=
this
window
.
tinymce
.
init
({
selector
:
`#
${
this
.
i
d
}
`
,
selector
:
`#
${
this
.
tinymceI
d
}
`
,
height
:
this
.
height
,
body_class
:
'panel-body '
,
object_resizing
:
false
,
...
...
@@ -153,12 +153,12 @@ export default {
imageSuccessCBK
(
arr
)
{
const
_this
=
this
arr
.
forEach
(
v
=>
{
window
.
tinymce
.
get
(
_this
.
i
d
).
insertContent
(
`<img class="wscnph" src="
${
v
.
url
}
" >`
)
window
.
tinymce
.
get
(
_this
.
tinymceI
d
).
insertContent
(
`<img class="wscnph" src="
${
v
.
url
}
" >`
)
})
}
},
destroyed
()
{
window
.
tinymce
.
get
(
this
.
i
d
).
destroy
()
window
.
tinymce
.
get
(
this
.
tinymceI
d
).
destroy
()
}
}
</
script
>
...
...
This diff is collapsed.
Click to expand it.
src/views/components/tinymce.vue
View file @
6a8a02f8
...
...
@@ -2,7 +2,7 @@
<div
class=
"components-container"
>
<code>
公司做的后台主要是一个cms系统,公司也是以自媒体为核心的,所以富文本是后台很核心的功能。在选择富文本的过程中也走了不少的弯路,市面上常见的富文本都基本用过了,最终选择了Tinymce
<a
target=
'_blank'
href=
'https://segmentfault.com/a/1190000009762198#articleHeader13'
>
相关文章
</a>
<a
target=
'_blank'
href=
'https://www.tinymce.com/'
>
官网
</a></code>
<div>
<tinymce
:height=
200
ref=
"editor"
v-model=
"content"
></tinymce>
<tinymce
:height=
'200'
v-model=
"content"
></tinymce>
</div>
<div
class=
'editor-content'
v-html=
'content'
></div>
</div>
...
...
This diff is collapsed.
Click to expand it.
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