Last active
July 13, 2017 14:34
-
-
Save winguse/d53f81d2d86f057ce9deefde96bcac3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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