Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cover restoring and fetch function fixed #101

Merged
merged 9 commits into from
Dec 25, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
cover restoring fixed
  • Loading branch information
khaydarov committed Dec 19, 2016
commit 8dea3af111412509fbba39006bcac0e27f407597
14 changes: 9 additions & 5 deletions codex-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,40 @@
<textarea name="" id="codex_area" cols="30" rows="10" hidden></textarea>

</body>

<script src="./plugins.js?v=10"></script>
<script src="./codex-editor.js?v=10"></script>
<link rel="stylesheet" href="./codex-editor.css?v=10">

<script>
codex.start({
textareaId : "codex_area",
tools : tools,
data : {
items: [],
items: [
{
type : 'paragraph',
data : {
text : "The promise constructor takes one argument, a callback with two parameters, resolve and reject. Do something within the callback, perhaps async, then call resolve if everything worked, otherwise call reject.Like 'throw' in plain old JavaScript, it's customary, but not required, to reject with an Error object. The benefit of Error objects is they capture a stack trace, making debugging tools more helpful. Here's how you use that promise:",
},
cover : true
}
],
count: 0
}
});
</script>

<link rel="stylesheet" href="codex-editor.css">

<link rel="stylesheet" href="plugins/paragraph/paragraph.css">
<link rel="stylesheet" href="plugins/code/code.css">
<link rel="stylesheet" href="plugins/header/header.css">
<link rel="stylesheet" href="plugins/image/image.css">
<link rel="stylesheet" href="plugins/instagram/instagram.css">
<link rel="stylesheet" href="plugins/link/link.css">
<link rel="stylesheet" href="plugins/list/list.css">
<link rel="stylesheet" href="plugins/paste/paste.css">
<link rel="stylesheet" href="plugins/twitter/twitter.css">


</html>
5 changes: 5 additions & 0 deletions modules/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,15 @@ var content = (function(content) {
var workingBlock = codex.content.currentNode,
newBlockContent = blockData.block,
blockType = blockData.type,
cover = blockData.cover,
isStretched = blockData.stretched;

var newBlock = codex.content.composeNewBlock(newBlockContent, blockType, isStretched);

if (cover === true) {
newBlock.classList.add(codex.ui.className.BLOCK_IN_FEED_MODE);
}

if (workingBlock) {

codex.core.insertAfter(workingBlock, newBlock);
Expand Down
9 changes: 4 additions & 5 deletions modules/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ var renderer = (function(renderer) {
renderer.createBlockFromData = function (blockData) {

/** New parser */
var pluginName = blockData.type;
var pluginName = blockData.type,
cover = blockData.cover;

/** Get first key of object that stores plugin name */
// for (var pluginName in blockData) break;
Expand All @@ -148,17 +149,15 @@ var renderer = (function(renderer) {
/** New Parser */
var block = codex.tools[pluginName].render(blockData.data);

/** Fire the render method with data */
// var block = codex.tools[pluginName].render(blockData[pluginName]);

/** is first-level block stretched */
var stretched = codex.tools[pluginName].isStretched || false;

/** Retrun type and block */
return {
type : pluginName,
block : block,
stretched : stretched
stretched : stretched,
cover : cover
};

};
Expand Down
Loading