Created
November 17, 2019 00:19
-
-
Save branflake2267/e07e2e7c1ed3c906a790cc4dda0b3fc3 to your computer and use it in GitHub Desktop.
Froala Editor with RequireJs usage.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Load CSS files. --> | |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/css/froala_editor.css"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script> | |
<script> | |
// 1. Define the Froala Editor resources import path | |
require.config({ | |
packages: [{ | |
name: 'froala-editor', | |
main: 'js/froala_editor.min' | |
}], | |
paths: { | |
// Change this to your server if you do not wish to use our CDN. | |
'froala-editor': 'https://cdn.jsdelivr.net/npm/[email protected]' | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<style> | |
#editor { | |
margin: 50px; | |
} | |
</style> | |
</head> | |
<script> | |
window.addEventListener('DOMContentLoaded', (event) => { | |
// 3. Render the editor when the DOM is ready | |
require([ | |
'froala-editor', | |
'froala-editor/js/plugins/align.min' | |
], function (FroalaEditor) { | |
new FroalaEditor('#editor') | |
}); | |
}); | |
</script> | |
<body> | |
<!-- 2. Declare where the editor will render --> | |
<div id='editor'></div> | |
</body> | |
</body> | |
</html> |
Author
branflake2267
commented
Nov 17, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment