Skip to content

Instantly share code, notes, and snippets.

@winguse
Last active July 13, 2017 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save winguse/d53f81d2d86f057ce9deefde96bcac3a to your computer and use it in GitHub Desktop.
Save winguse/d53f81d2d86f057ce9deefde96bcac3a to your computer and use it in GitHub Desktop.
const getMaskHtml = height =>
`<svg width="100%" height="${height}" xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="${height}" style="fill: rgb(254, 254, 254);">
<animate attributeName="opacity" begin="click" dur="6s" from="1" to="0" fill="freeze"></animate>
</rect>
</svg>`;
const setMask = content => {
if (content.indexOf('</svg>') > 0) {
console.log('added')
return content;
} else {
console.log('to add')
}
const height = 1200; // this value is to be define
return `<section style="height: ${height}px">${content}</section><section style="height: ${height}px; margin-top: -${height}px;">${getMaskHtml(height)}</section>`;
};
const operations = [ setMask ];
const { editor } = $EDITORUI.edui1;
editor._getContent = editor.getContent;
editor.getContent = function (...args) {
return operations.reduce((content, op) => {
return op(content);
}, this._getContent(...args))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment