framework icon indicating copy to clipboard operation
framework copied to clipboard

Editor field in Infinite Field

Open conradfuhrman opened this issue 9 years ago • 8 comments

Would love to have the editor field in an infinite field. Currently if you add one, it will overwrite the previous fields that exist in it. If there is a current way to get it to function, I am unaware of how to get it to work.

conradfuhrman avatar May 31 '15 22:05 conradfuhrman

Hi,

this issue is already known. In order to make it work, we have to rename a lot of html tags when inserting new rows containing the editor. It might get updated but we'll have to dig more into the TinyMCE editor api.

jlambe avatar Jun 01 '15 05:06 jlambe

Currently experiencing what I believe is a related error. It occurs when there is an editor field inside an infinite field -- you can replicate this by adding a second row.

Uncaught TypeError: Cannot read property 'replace' of undefinedInfiniteApp.Views.Infinite.Backbone.View.extend.renameName @ _themosis-core.js?ver=4.2.4:1269

InfiniteApp.Views.Infinite.Backbone.View.extend.renameField @ _themosis-core.js?ver=4.2.4:1231
(anonymous function) @ _themosis-core.js?ver=4.2.4:1177
j.each.j.forEach @ underscore.min.js?ver=1.6.0:5
(anonymous function) @ _themosis-core.js?ver=4.2.4:1174
j.each.j.forEach @ underscore.min.js?ver=1.6.0:5
(anonymous function) @ _themosis-core.js?ver=4.2.4:1160
j.each.j.forEach @ underscore.min.js?ver=1.6.0:5
InfiniteApp.Views.Infinite.Backbone.View.extend.rename @ _themosis-core.js?ver=4.2.4:1149
InfiniteApp.Views.Infinite.Backbone.View.extend.update @ _themosis-core.js?ver=4.2.4:1131
InfiniteApp.Views.Infinite.Backbone.View.extend.add @ _themosis-core.js?ver=4.2.4:1081
InfiniteApp.Views.Add.Backbone.View.extend.addRow @ _themosis-core.js?ver=4.2.4:976
m.event.dispatch @ jquery.js?ver=1.11.2:3m.event.add.r.handle @ jquery.js?ver=1.11.2:3

jglover avatar Aug 18 '15 05:08 jglover

This issue is known but no solution found yet. You can't currently add the "Editor" field in an "infinite" field.

jlambe avatar Aug 18 '15 11:08 jlambe

Hello @jlambe .

Any news on this ? Maybe a Workaround ?

Varkal avatar Feb 19 '17 12:02 Varkal

@Varkal No updates at the moment. Next release will be a complete field api refactoring but no changes planned now.

jlambe avatar Feb 19 '17 18:02 jlambe

OK no problem :-)

Maybe an approximative release date for next version ? (Very impatient to use it, if it may this possible)

By the way, I need to tell you that your framework is really awesome. And thank you ;-)

Varkal avatar Feb 19 '17 18:02 Varkal

@Varkal Thanks. No release date at the moment unfortunately.

jlambe avatar Feb 19 '17 19:02 jlambe

Hi! I found a workaround for this one. you can side load tinymce js to the admin.

Asset::add('tinymcejs', 'https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=api-key', [], '1.0', true)->to('admin');

and also load a custom script from the admin

jQuery(window).load(function() {
    "use strict";

    tinymce.init({
      selector: 'textarea.large-text.tinymce',
      height: 200,
      menubar: false,
      plugins: [
        'advlist autolink lists link image charmap print preview anchor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table contextmenu paste code'
      ],
      toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
      content_css: [
        '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
        '//www.tinymce.com/css/codepen.min.css']
    });

});

and insert a class on your textare field within an infinite field

    Field::infinite('features',[
	    Field::text('title', [
	    	'title' => 'Title'
	    ]),
    	Field::textarea('description', [], [
			'class' => 'large-text tinymce'
		]),
		Field::media('image', [
		    'type' => ['image']
		]),
    ]),

it would look something like this infinite editor field

ThinkDevStudios avatar Jun 06 '17 14:06 ThinkDevStudios