braft-convert
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -303,6 +303,29 @@ "use strict"; | ||
} else if (blockType === 'code-block') { | ||
return { | ||
start: "<pre><code" + blockStyle + ">", | ||
end: '</code></pre>' | ||
}; | ||
var previousBlock = contentState.getBlockBefore(block.key); | ||
var nextBlock = contentState.getBlockAfter(block.key); | ||
var previousBlockType = previousBlock && previousBlock.getType(); | ||
var nextBlockType = nextBlock && nextBlock.getType(); | ||
if (previousBlockType === 'code-block' && nextBlockType === 'code-block') { | ||
return { | ||
start: "<code" + blockStyle + "><div>", | ||
end: '</div></code>' | ||
}; | ||
} else if (previousBlockType === 'code-block') { | ||
return { | ||
start: "<code" + blockStyle + "><div>", | ||
end: '</div></code></pre>' | ||
}; | ||
} else if (nextBlockType === 'code-block') { | ||
return { | ||
start: "<pre><code" + blockStyle + "><div>", | ||
end: '</div></code>' | ||
}; | ||
} else { | ||
return { | ||
start: "<pre><code" + blockStyle + "><div>", | ||
end: '</div></code></pre>' | ||
}; | ||
} | ||
} else if (blocks[blockType]) { | ||
@@ -309,0 +332,0 @@ return { |
{ | ||
"name": "braft-convert", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "A convert helper for Braft Editor.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207175
549