HtmlEditor.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-layout-component-field-HtmlEditor'>/**
  19. </span> * Layout class for {@link Ext.form.field.HtmlEditor} fields. Sizes the toolbar, textarea, and iframe elements.
  20. * @private
  21. */
  22. Ext.define('Ext.layout.component.field.HtmlEditor', {
  23. extend: 'Ext.layout.component.field.Field',
  24. alias: ['layout.htmleditor'],
  25. type: 'htmleditor',
  26. // Flags to say that the item is autosizing itself.
  27. toolbarSizePolicy: {
  28. setsWidth: 0,
  29. setsHeight: 0
  30. },
  31. beginLayout: function(ownerContext) {
  32. this.callParent(arguments);
  33. ownerContext.textAreaContext = ownerContext.getEl('textareaEl');
  34. ownerContext.iframeContext = ownerContext.getEl('iframeEl');
  35. ownerContext.toolbarContext = ownerContext.context.getCmp(this.owner.getToolbar());
  36. },
  37. // It's not a container, can never add/remove dynamically
  38. renderItems: Ext.emptyFn,
  39. getItemSizePolicy: function (item) {
  40. // we are only ever called by the toolbar
  41. return this.toolbarSizePolicy;
  42. },
  43. getLayoutItems: function () {
  44. var toolbar = this.owner.getToolbar();
  45. // The toolbar may not exist if we're destroying
  46. return toolbar ? [toolbar] : [];
  47. },
  48. getRenderTarget: function() {
  49. return this.owner.bodyEl;
  50. },
  51. publishInnerHeight: function (ownerContext, height) {
  52. var me = this,
  53. innerHeight = height - me.measureLabelErrorHeight(ownerContext) -
  54. ownerContext.toolbarContext.getProp('height') -
  55. ownerContext.bodyCellContext.getPaddingInfo().height;
  56. // If the Toolbar has not acheieved a height yet, we are not done laying out.
  57. if (Ext.isNumber(innerHeight)) {
  58. ownerContext.textAreaContext.setHeight(innerHeight);
  59. ownerContext.iframeContext.setHeight(innerHeight);
  60. } else {
  61. me.done = false;
  62. }
  63. }
  64. });</pre>
  65. </body>
  66. </html>