01.
<script src=
"//cdn.ckeditor.com/4.5.3/full/ckeditor.js"
></script>
02.
<textarea name=
"editor1"
></textarea>
03.
<style type=
"text/css"
>
04.
.cke_button__mybutton_icon {
05.
display: none !important;
06.
}
07.
.cke_button__mybutton_label {
08.
display : inline !important;
09.
}
10.
</style>
11.
<script>
12.
editor = CKEDITOR.replace(
'editor1'
, {
13.
allowedContent :
true
,
14.
enterMode : CKEDITOR.ENTER_BR,
15.
enableTabKeyTools :
true
16.
} );
17.
editor.on(
'pluginsLoaded'
,
function
(){
18.
editor.addCommand(
'svData'
, {
19.
modes : { source : 1,wysiwyg : 1 },
20.
exec :
function
( editor ) {
21.
localStorage[
"_save_ck_code"
] = editor.getData();
22.
}
23.
});
24.
editor.ui.addToolbarGroup(
"user"
);
25.
editor.ui.addButton(
'mybutton'
, {
26.
label :
'入力内容を保存'
, command :
'svData'
, toolbar:
'user'
27.
} );
28.
var
editor_code = localStorage[
"_save_ck_code"
];
29.
if
(
typeof
editor_code ==
'string'
){
30.
editor.setData(localStorage[
"_save_ck_code"
]);
31.
}
32.
});
33.
</script>