froala / wysiwyg-rails

Ruby gem for Froala jQuery WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
465 stars 102 forks source link

Resizing uploaded image when fresh load not working. #49

Closed fedesc closed 7 years ago

fedesc commented 7 years ago

rails -v Rails 4.2.7.1 ruby -v ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16] Turbolinks -v '~> 5.0.0'

When navigation to a page with an editor . when uploading an image. the resize border works just fine.

if i refresh the page it doesn't work (seems like the size are freezing)

i'm noticing a difference in tag.

when not working it has a stuck style of width

and when working it plays with width and height.

This is how i setup wysiwyg `// toolbar buttons var toolbarSlim = ['undo', 'redo', '|', 'insertImage', '|', 'specialCharacters', '|', 'fontFamily', 'fontSize', 'paragraphFormat'] var toolbarFull = ['undo', 'redo', '|', 'insertImage', 'insertLink', 'insertVideo', 'insertTable', 'specialCharacters', 'insertHR', '|', 'fontFamily', 'fontSize', 'paragraphFormat', 'bold', 'italic', 'underline', 'color', 'strikeThrough', '|', 'subscript', 'superscript', '|', 'align', '|', 'formatOL', 'formatUL', '|', 'indent', 'outdent', '|', 'quote', '|', 'clearFormatting']

function initWysiwyg($el, options) { // available pre options [placeholder, inline]

// set empty object if none was passed. if (typeof options === 'undefined') { var options = {}; }

// general options
options.zIndex = 1001; // procedure tabs in beta are 1000 - needs to be above

options.charCounterCount = false; // character count

// toolbars options.toolbarButtons = toolbarFull; options.toolbarButtonsMD = toolbarFull; options.toolbarButtonsSM = toolbarFull; options.toolbarButtonsXS = toolbarSlim;

// custom placeholder or default - passed {placeholder: 'string'} if (options.hasOwnProperty('placeholder')) { options.placeholderText = options.placeholder delete options.placeholder; } else { options.placeholderText = 'Enter text here...' delete options.placeholder; }

// editor type inline/regular - passed {inline: true} if (options.hasOwnProperty('inline')) { options.toolbarInline = true; options.toolbarVisibleWithoutSelection = true; delete options.inline; }

// image uploads options.imageUploadURL = '/system/attachments/image_upload.json?embedded=true'; options.imageUploadMethod = 'POST'; options.imageUploadParam = 'image'; // params[:image] options.imageDefaultWidth = 0; // setting to zero uploads regular image size options.imagePasteProcess = true; //handles copy pasted images with same action as upload from editor

// initialize froalaEditor $el.froalaEditor(options);

}`

than i load the selector with the editor and that's pretty much

is there a known library that is known for conflicts or something relevant? I'm kinda lost here no error is loged. Only not working when page is refreshed (not navigation into).

Please if need more info that i haven't thought about . drop a line.

Thanks