mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 02:40:23 +02:00
fix changes
This commit is contained in:
parent
94b3d67b1f
commit
457a53226f
447
example.html
447
example.html
|
@ -17,228 +17,239 @@
|
|||
|
||||
</body>
|
||||
|
||||
<!--<script src="plugins/paragraph/paragraph.js?v=100"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/paragraph/paragraph.css">-->
|
||||
|
||||
<!--<script src="plugins/header/header.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/header/header.css">-->
|
||||
|
||||
<!--<script src="plugins/code/code.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/code/code.css">-->
|
||||
|
||||
<!--<script src="plugins/link/link.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/link/link.css">-->
|
||||
|
||||
<!--<script src="plugins/quote/quote.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/quote/quote.css">-->
|
||||
|
||||
<!--<script src="plugins/list/list.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/list/list.css">-->
|
||||
|
||||
<!--<script src="plugins/image/image.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/image/image.css">-->
|
||||
|
||||
<!--<script src="plugins/instagram/instagram.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/instagram/instagram.css">-->
|
||||
|
||||
<!--<script src="plugins/twitter/twitter.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/twitter/twitter.css">-->
|
||||
|
||||
<!--<script src="plugins/embed/embed.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/embed/embed.css">-->
|
||||
|
||||
<!--<script src="plugins/raw/raw.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/raw/raw.css">-->
|
||||
|
||||
<!--<script src="plugins/attaches/attaches.js"></script>-->
|
||||
<!--<link rel="stylesheet" href="plugins/attaches/attaches.css">-->
|
||||
|
||||
<script src="codex-editor.js?v=108"></script>
|
||||
<link rel="stylesheet" href="codex-editor.css?v=11000">
|
||||
|
||||
<script src="plugins/paragraph/paragraph.js?v=100"></script>
|
||||
<link rel="stylesheet" href="plugins/paragraph/paragraph.css">
|
||||
|
||||
<script src="plugins/header/header.js"></script>
|
||||
<link rel="stylesheet" href="plugins/header/header.css">
|
||||
|
||||
<script src="plugins/code/code.js"></script>
|
||||
<link rel="stylesheet" href="plugins/code/code.css">
|
||||
|
||||
<script src="plugins/link/link.js"></script>
|
||||
<link rel="stylesheet" href="plugins/link/link.css">
|
||||
|
||||
<script src="plugins/quote/quote.js"></script>
|
||||
<link rel="stylesheet" href="plugins/quote/quote.css">
|
||||
|
||||
<script src="plugins/list/list.js"></script>
|
||||
<link rel="stylesheet" href="plugins/list/list.css">
|
||||
|
||||
<script src="plugins/image/image.js"></script>
|
||||
<link rel="stylesheet" href="plugins/image/image.css">
|
||||
|
||||
<script src="plugins/instagram/instagram.js"></script>
|
||||
<link rel="stylesheet" href="plugins/instagram/instagram.css">
|
||||
|
||||
<script src="plugins/twitter/twitter.js"></script>
|
||||
<link rel="stylesheet" href="plugins/twitter/twitter.css">
|
||||
|
||||
<script src="plugins/embed/embed.js"></script>
|
||||
<link rel="stylesheet" href="plugins/embed/embed.css">
|
||||
|
||||
<script src="plugins/raw/raw.js"></script>
|
||||
<link rel="stylesheet" href="plugins/raw/raw.css">
|
||||
|
||||
<script src="plugins/attaches/attaches.js"></script>
|
||||
<link rel="stylesheet" href="plugins/attaches/attaches.css">
|
||||
|
||||
<script>
|
||||
codex.editor.start({
|
||||
holderId : "codex-editor",
|
||||
initialBlockPlugin : 'paragraph',
|
||||
// placeholder: 'Прошлой ночью мне приснилось...',
|
||||
hideToolbar: false,
|
||||
tools : {
|
||||
paragraph: {
|
||||
type: 'paragraph',
|
||||
iconClassname: 'ce-icon-paragraph',
|
||||
render: paragraph.render,
|
||||
validate: paragraph.validate,
|
||||
save: paragraph.save,
|
||||
destroy: paragraph.destroy,
|
||||
allowedToPaste: true,
|
||||
showInlineToolbar: true,
|
||||
allowRenderOnPaste: true
|
||||
},
|
||||
header: {
|
||||
type: 'header',
|
||||
iconClassname: 'ce-icon-header',
|
||||
appendCallback: header.appendCallback,
|
||||
makeSettings: header.makeSettings,
|
||||
render: header.render,
|
||||
validate: header.validate,
|
||||
save: header.save,
|
||||
destroy: header.destroy,
|
||||
displayInToolbox: true
|
||||
},
|
||||
code: {
|
||||
type: 'code',
|
||||
iconClassname: 'ce-icon-code',
|
||||
make: code.make,
|
||||
appendCallback: null,
|
||||
settings: null,
|
||||
render: code.render,
|
||||
validate: code.validate,
|
||||
save: code.save,
|
||||
destroy: code.destroy,
|
||||
displayInToolbox: true,
|
||||
enableLineBreaks: true
|
||||
},
|
||||
link: {
|
||||
type: 'link',
|
||||
iconClassname: 'ce-icon-link',
|
||||
prepare: link.prepare,
|
||||
make: link.makeNewBlock,
|
||||
appendCallback: link.appendCallback,
|
||||
render: link.render,
|
||||
validate: link.validate,
|
||||
save: link.save,
|
||||
destroy: link.destroy,
|
||||
displayInToolbox: true,
|
||||
enableLineBreaks: true
|
||||
},
|
||||
list: {
|
||||
type: 'list',
|
||||
iconClassname: 'ce-icon-list-bullet',
|
||||
make: list.make,
|
||||
appendCallback: null,
|
||||
makeSettings: list.makeSettings,
|
||||
render: list.render,
|
||||
validate: list.validate,
|
||||
save: list.save,
|
||||
destroy: list.destroy,
|
||||
displayInToolbox: true,
|
||||
showInlineToolbar: true,
|
||||
enableLineBreaks: true,
|
||||
allowedToPaste: true,
|
||||
},
|
||||
quote: {
|
||||
type: 'quote',
|
||||
iconClassname: 'ce-icon-quote',
|
||||
makeSettings: quote.makeSettings,
|
||||
prepare: quote.prepare,
|
||||
render: quote.render,
|
||||
validate: quote.validate,
|
||||
save: quote.save,
|
||||
destroy: quote.destroy,
|
||||
displayInToolbox: true,
|
||||
enableLineBreaks: true,
|
||||
showInlineToolbar: true,
|
||||
allowedToPaste: true,
|
||||
config : {
|
||||
defaultStyle : 'withPhoto'
|
||||
}
|
||||
},
|
||||
image_extended: {
|
||||
type: 'image_extended',
|
||||
iconClassname: 'ce-icon-picture',
|
||||
appendCallback: image.appendCallback,
|
||||
prepare: image.prepare,
|
||||
makeSettings: image.makeSettings,
|
||||
render: image.render,
|
||||
save: image.save,
|
||||
destroy: image.destroy,
|
||||
isStretched: true,
|
||||
showInlineToolbar: true,
|
||||
displayInToolbox: true,
|
||||
renderOnPastePatterns: image.pastePatterns,
|
||||
config: {
|
||||
uploadImage : '/writing/uploadImage',
|
||||
uploadFromUrl : '/club/fetch'
|
||||
}
|
||||
},
|
||||
instagram: {
|
||||
type: 'instagram',
|
||||
iconClassname: 'ce-icon-instagram',
|
||||
prepare: instagram.prepare,
|
||||
render: instagram.render,
|
||||
validate: instagram.validate,
|
||||
save: instagram.save,
|
||||
destroy: instagram.destroy,
|
||||
renderOnPastePatterns: instagram.pastePatterns,
|
||||
},
|
||||
tweet: {
|
||||
type: 'tweet',
|
||||
iconClassname: 'ce-icon-twitter',
|
||||
prepare: twitter.prepare,
|
||||
render: twitter.render,
|
||||
validate: twitter.validate,
|
||||
save: twitter.save,
|
||||
destroy: twitter.destroy,
|
||||
showInlineToolbar : true,
|
||||
renderOnPastePatterns: twitter.pastePatterns,
|
||||
config : {
|
||||
fetchUrl : ''
|
||||
}
|
||||
},
|
||||
video_extended: {
|
||||
type: 'video_extended',
|
||||
make: embed.make,
|
||||
render: embed.render,
|
||||
save: embed.save,
|
||||
destroy: embed.destroy,
|
||||
validate: embed.validate,
|
||||
renderOnPastePatterns: embed.pastePatterns,
|
||||
},
|
||||
raw: {
|
||||
type: 'raw',
|
||||
displayInToolbox: true,
|
||||
iconClassname: 'raw-plugin-icon',
|
||||
render: rawPlugin.render,
|
||||
save: rawPlugin.save,
|
||||
validate: rawPlugin.validate,
|
||||
destroy: rawPlugin.destroy,
|
||||
enableLineBreaks: true,
|
||||
allowPasteHTML: true
|
||||
},
|
||||
attaches: {
|
||||
type: 'attaches',
|
||||
displayInToolbox: true,
|
||||
iconClassname: 'cdx-attaches__icon',
|
||||
prepare: cdxAttaches.prepare,
|
||||
render: cdxAttaches.render,
|
||||
save: cdxAttaches.save,
|
||||
validate: cdxAttaches.validate,
|
||||
destroy: cdxAttaches.destroy,
|
||||
appendCallback: cdxAttaches.appendCallback,
|
||||
config: {
|
||||
fetchUrl: '/test',
|
||||
maxSize: 50000,
|
||||
}
|
||||
},
|
||||
},
|
||||
data : {
|
||||
id: +new Date(),
|
||||
items: [
|
||||
{
|
||||
type : 'header',
|
||||
data : {
|
||||
text : 'Привет от CodeX'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
data : {
|
||||
text : 'Пишите нам на team@ifmo.su'
|
||||
}
|
||||
},
|
||||
],
|
||||
count: 3
|
||||
}
|
||||
codex = {};
|
||||
codex.editor = 1;
|
||||
var editor = new CodexEditor({
|
||||
holderId : 'codex-editor',
|
||||
inittialBlock : 'paragraph'
|
||||
});
|
||||
|
||||
var editor2 = new CodexEditor({
|
||||
holderId : 'cdx',
|
||||
initialBlock: 'header'
|
||||
});
|
||||
// codex.editor.start({
|
||||
// holderId : "codex-editor",
|
||||
// initialBlockPlugin : 'paragraph',
|
||||
// // placeholder: 'Прошлой ночью мне приснилось...',
|
||||
// hideToolbar: false,
|
||||
// tools : {
|
||||
// paragraph: {
|
||||
// type: 'paragraph',
|
||||
// iconClassname: 'ce-icon-paragraph',
|
||||
// render: paragraph.render,
|
||||
// validate: paragraph.validate,
|
||||
// save: paragraph.save,
|
||||
// destroy: paragraph.destroy,
|
||||
// allowedToPaste: true,
|
||||
// showInlineToolbar: true,
|
||||
// allowRenderOnPaste: true
|
||||
// },
|
||||
// header: {
|
||||
// type: 'header',
|
||||
// iconClassname: 'ce-icon-header',
|
||||
// appendCallback: header.appendCallback,
|
||||
// makeSettings: header.makeSettings,
|
||||
// render: header.render,
|
||||
// validate: header.validate,
|
||||
// save: header.save,
|
||||
// destroy: header.destroy,
|
||||
// displayInToolbox: true
|
||||
// },
|
||||
// code: {
|
||||
// type: 'code',
|
||||
// iconClassname: 'ce-icon-code',
|
||||
// make: code.make,
|
||||
// appendCallback: null,
|
||||
// settings: null,
|
||||
// render: code.render,
|
||||
// validate: code.validate,
|
||||
// save: code.save,
|
||||
// destroy: code.destroy,
|
||||
// displayInToolbox: true,
|
||||
// enableLineBreaks: true
|
||||
// },
|
||||
// link: {
|
||||
// type: 'link',
|
||||
// iconClassname: 'ce-icon-link',
|
||||
// prepare: link.prepare,
|
||||
// make: link.makeNewBlock,
|
||||
// appendCallback: link.appendCallback,
|
||||
// render: link.render,
|
||||
// validate: link.validate,
|
||||
// save: link.save,
|
||||
// destroy: link.destroy,
|
||||
// displayInToolbox: true,
|
||||
// enableLineBreaks: true
|
||||
// },
|
||||
// list: {
|
||||
// type: 'list',
|
||||
// iconClassname: 'ce-icon-list-bullet',
|
||||
// make: list.make,
|
||||
// appendCallback: null,
|
||||
// makeSettings: list.makeSettings,
|
||||
// render: list.render,
|
||||
// validate: list.validate,
|
||||
// save: list.save,
|
||||
// destroy: list.destroy,
|
||||
// displayInToolbox: true,
|
||||
// showInlineToolbar: true,
|
||||
// enableLineBreaks: true,
|
||||
// allowedToPaste: true,
|
||||
// },
|
||||
// quote: {
|
||||
// type: 'quote',
|
||||
// iconClassname: 'ce-icon-quote',
|
||||
// makeSettings: quote.makeSettings,
|
||||
// prepare: quote.prepare,
|
||||
// render: quote.render,
|
||||
// validate: quote.validate,
|
||||
// save: quote.save,
|
||||
// destroy: quote.destroy,
|
||||
// displayInToolbox: true,
|
||||
// enableLineBreaks: true,
|
||||
// showInlineToolbar: true,
|
||||
// allowedToPaste: true,
|
||||
// config : {
|
||||
// defaultStyle : 'withPhoto'
|
||||
// }
|
||||
// },
|
||||
// image_extended: {
|
||||
// type: 'image_extended',
|
||||
// iconClassname: 'ce-icon-picture',
|
||||
// appendCallback: image.appendCallback,
|
||||
// prepare: image.prepare,
|
||||
// makeSettings: image.makeSettings,
|
||||
// render: image.render,
|
||||
// save: image.save,
|
||||
// destroy: image.destroy,
|
||||
// isStretched: true,
|
||||
// showInlineToolbar: true,
|
||||
// displayInToolbox: true,
|
||||
// renderOnPastePatterns: image.pastePatterns,
|
||||
// config: {
|
||||
// uploadImage : '/writing/uploadImage',
|
||||
// uploadFromUrl : '/club/fetch'
|
||||
// }
|
||||
// },
|
||||
// instagram: {
|
||||
// type: 'instagram',
|
||||
// iconClassname: 'ce-icon-instagram',
|
||||
// prepare: instagram.prepare,
|
||||
// render: instagram.render,
|
||||
// validate: instagram.validate,
|
||||
// save: instagram.save,
|
||||
// destroy: instagram.destroy,
|
||||
// renderOnPastePatterns: instagram.pastePatterns,
|
||||
// },
|
||||
// tweet: {
|
||||
// type: 'tweet',
|
||||
// iconClassname: 'ce-icon-twitter',
|
||||
// prepare: twitter.prepare,
|
||||
// render: twitter.render,
|
||||
// validate: twitter.validate,
|
||||
// save: twitter.save,
|
||||
// destroy: twitter.destroy,
|
||||
// showInlineToolbar : true,
|
||||
// renderOnPastePatterns: twitter.pastePatterns,
|
||||
// config : {
|
||||
// fetchUrl : ''
|
||||
// }
|
||||
// },
|
||||
// video_extended: {
|
||||
// type: 'video_extended',
|
||||
// make: embed.make,
|
||||
// render: embed.render,
|
||||
// save: embed.save,
|
||||
// destroy: embed.destroy,
|
||||
// validate: embed.validate,
|
||||
// renderOnPastePatterns: embed.pastePatterns,
|
||||
// },
|
||||
// raw: {
|
||||
// type: 'raw',
|
||||
// displayInToolbox: true,
|
||||
// iconClassname: 'raw-plugin-icon',
|
||||
// render: rawPlugin.render,
|
||||
// save: rawPlugin.save,
|
||||
// validate: rawPlugin.validate,
|
||||
// destroy: rawPlugin.destroy,
|
||||
// enableLineBreaks: true,
|
||||
// allowPasteHTML: true
|
||||
// },
|
||||
// attaches: {
|
||||
// type: 'attaches',
|
||||
// displayInToolbox: true,
|
||||
// iconClassname: 'cdx-attaches__icon',
|
||||
// prepare: cdxAttaches.prepare,
|
||||
// render: cdxAttaches.render,
|
||||
// save: cdxAttaches.save,
|
||||
// validate: cdxAttaches.validate,
|
||||
// destroy: cdxAttaches.destroy,
|
||||
// appendCallback: cdxAttaches.appendCallback,
|
||||
// config: {
|
||||
// fetchUrl: '/test',
|
||||
// maxSize: 50000,
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
// data : {
|
||||
// id: +new Date(),
|
||||
// items: [
|
||||
// {
|
||||
// type : 'header',
|
||||
// data : {
|
||||
// text : 'Привет от CodeX'
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// type : 'paragraph',
|
||||
// data : {
|
||||
// text : 'Пишите нам на team@ifmo.su'
|
||||
// }
|
||||
// },
|
||||
// ],
|
||||
// count: 3
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
</html>
|
||||
|
|
34
package-lock.json
generated
34
package-lock.json
generated
|
@ -2493,6 +2493,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
|
@ -2503,14 +2511,6 @@
|
|||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"bundled": true,
|
||||
|
@ -4574,6 +4574,15 @@
|
|||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
|
@ -4585,15 +4594,6 @@
|
|||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
|
||||
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.1"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
|
|
|
@ -26,11 +26,11 @@ var ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
|
|||
module.exports = {
|
||||
|
||||
entry: {
|
||||
"codex-editor": "./codex"
|
||||
'codex-editor': './codex'
|
||||
},
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
library: ["codex","editor"]
|
||||
filename: '[name].js',
|
||||
library: [ 'CodexEditor' ]
|
||||
},
|
||||
|
||||
watch: true,
|
||||
|
@ -39,17 +39,17 @@ module.exports = {
|
|||
aggregateTimeOut: 50
|
||||
},
|
||||
|
||||
devtool: NODE_ENV == 'development' ? "source-map" : null,
|
||||
devtool: NODE_ENV == 'development' ? 'source-map' : null,
|
||||
|
||||
resolve : {
|
||||
fallback: path.join(__dirname, "node_modules"),
|
||||
modulesDirectories : ['./node_modules', './modules'],
|
||||
fallback: path.join(__dirname, 'node_modules'),
|
||||
modulesDirectories : [ './modules' ],
|
||||
extensions : ['', '.js', '.json']
|
||||
},
|
||||
|
||||
resolveLoader : {
|
||||
modulesDirectories: ['./node_modules'],
|
||||
moduleTemplates: ["*-webpack-loader", "*-web-loader", "*-loader", "*"],
|
||||
modulesDirectories: [ './node_modules' ],
|
||||
moduleTemplates: ['*-webpack-loader', '*-web-loader', '*-loader', '*'],
|
||||
extensions: ['', '.js']
|
||||
},
|
||||
|
||||
|
@ -62,12 +62,12 @@ module.exports = {
|
|||
}),
|
||||
|
||||
/** Минифицируем CSS и JS */
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
// new webpack.optimize.UglifyJsPlugin({
|
||||
/** Disable warning messages. Cant disable uglify for 3rd party libs such as html-janitor */
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
}),
|
||||
// compress: {
|
||||
// warnings: false
|
||||
// }
|
||||
// }),
|
||||
|
||||
/** Block biuld if errors found */
|
||||
new webpack.NoErrorsPlugin(),
|
||||
|
@ -76,23 +76,23 @@ module.exports = {
|
|||
|
||||
module : {
|
||||
|
||||
loaders : [{
|
||||
loaders : [ {
|
||||
test : /\.js$/,
|
||||
exclude: /(node_modules)/,
|
||||
exclude: /node_modules/,
|
||||
loader : 'babel',
|
||||
query: {
|
||||
presets: [__dirname + '/node_modules/babel-preset-es2015']
|
||||
presets: [ __dirname + '/node_modules/babel-preset-es2015' ]
|
||||
}
|
||||
},
|
||||
{
|
||||
test : /\.js$/,
|
||||
loader: 'eslint-loader?fix=true',
|
||||
exclude: /(node_modules)/
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{
|
||||
test : /\.css$/,
|
||||
exclude: /(node_modules)/,
|
||||
exclude: /node_modules/,
|
||||
loader: ExtractTextWebpackPlugin.extract('style-loader', 'css-loader')
|
||||
}]
|
||||
} ]
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue