A Pen by Edson Perotoni on CodePen.
Created
December 13, 2023 19:18
-
-
Save muath-ye/a8515b92f30377137fae53f5a3d619a1 to your computer and use it in GitHub Desktop.
How get the height from document body in CKEDITOR
This file contains 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
<textarea name="editor1">Type here and show console to see editor's height</textarea> |
This file contains 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
CKEDITOR.replace( 'editor1' ); | |
CKEDITOR.on( 'instanceReady', function( evt ) | |
{ | |
var editor = evt.editor; | |
editor.on('change', function (e) { | |
var contentSpace = editor.ui.space('contents'); | |
var ckeditorFrameCollection = contentSpace.$.getElementsByTagName('iframe'); | |
var ckeditorFrame = ckeditorFrameCollection[0]; | |
var innerDoc = ckeditorFrame.contentDocument; | |
var innerDocTextAreaHeight = $(innerDoc.body).height(); | |
console.log(innerDocTextAreaHeight); | |
}); | |
}); |
This file contains 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
<script src="https://cdn.ckeditor.com/4.13.0/standard/ckeditor.js"></script> | |
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment