hdjs
Version:
hdjs framework
29 lines (27 loc) • 963 B
JavaScript
(function() {
$(function() {
var $preview, editor, mobileToolbar, toolbar;
Simditor.locale = 'en-US';
toolbar = ['title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment'];
mobileToolbar = ["bold", "underline", "strikethrough", "color", "ul", "ol"];
if (mobilecheck()) {
toolbar = mobileToolbar;
}
editor = new Simditor({
textarea: $('#txt-content'),
placeholder: '这里输入文字...',
toolbar: toolbar,
pasteImage: true,
defaultImage: 'assets/images/image.png',
upload: location.search === '?upload' ? {
url: '/upload'
} : false
});
$preview = $('#preview');
if ($preview.length > 0) {
return editor.on('valuechanged', function(e) {
return $preview.html(editor.getValue());
});
}
});
}).call(this);