Forum Replies Created
-
AuthorPosts
-
February 19, 2021 at 8:48 pm in reply to: editor field broken in add more fields on latest piklist #11145
alexdParticipanthi steve, thanks for super fast answer. I actually had that plugin enabled previously and deactivated it to try and narrow the issue.
But what i find confusing is, your own piklist demo content features quite a few WYSIWYG in add more context in the add more tab.
And none of these examples in your demo work. I’m sure you must have tried them in one of the iterations since we moved to piklist v1x (i was previously on 0.9)Do you you know a combination of piklist version / WP version after 4.9 where the demos work?
if i can get the demos working on a given version combo that’s definitely good enough, don’t need to be at the latest version of WP necessarily for now.thanks again for taking the time to respond.
alexdParticipantjust to be clear, does this mean currently on WP 5X, there is currently no way to run a WYSIWYG in an add_more field?
is there any kind of known work around?February 19, 2021 at 8:39 pm in reply to: editor field broken in add more fields on latest piklist #11142
alexdParticipantI thought i looked, but i guess not well enough.
Here is a user reporting the exact same issue and your response:so i guess that’s my answer 🙁
good luck on v2.0
alexdParticipant@Stephen do you want to describe your conditional logic briefly?
As to your other post, and I believe steven will confirm if he reads this, it doesn’t seem to matter whether your fields are grouped or not (serialized or not) when dealing with this UI addmore issue.
alexdParticipantSteve has taken the time to comment that although they are continually working on it, the JS is in what they consider a pretty optimized place.
With minimal investigation we believe this to be a JS problem only.
After Steve’s advice, we find slightly better performance in FF and safari than chrome (OSX).Meanwhile we implemented ‘solution’ above.
I use the term solution lightly because it’s really more like a layout hack/workaround.
We subgroup fields, groups are given a class. We bind a change event to a select field for toggling between show/hide classes.
We then disable all conditionals.
Performance wise, this is working well for us.Problems:
Saving all empty values from hidden fields (we have to catch this)No access to values based on conditions (our scenario employs only show/hide).
alexdParticipanthey @skytsunami did you manage to make this work in piklist or did you have to stay on with ACF?
alexdParticipantI ended up adding something which is working here.
Jquery ui widget which toggles height of the parent addmoreIt’s a bit crude right now, as I’m just manually adjusting the addmore group height on widget button toggle, probably the field template would need customizing to make this more robust, but it’s a starting point at least.
/** * * @custom.groupwrapper * */ $(function () { $.widget("custom.groupWrapper", { _create: function () { this.wrapper = $("<span>") .addClass("custom-groupwrapper") .prependTo(this.element); this._createDrawerButton(); }, _createDrawerButton: function () { console.log(this.wrapper); var _this = this; $("<a>") .attr("tabIndex", -1) .attr("title", "Collapse") .prependTo(this.wrapper) .button({ icons: { primary: "ui-icon-triangle-1-s" }, text: false }) .removeClass("ui-corner-all") .addClass("ui-corner-right") .on("click", function () { $(_this.wrapper) .closest('.piklist-field-addmore-wrapper-full') .toggleClass('hide'); }); }, _destroy: function () { this.wrapper.remove(); this.element.show(); } }); //@todo unify combobox autocomplete selector $(".piklist-field-addmore-wrapper-full").groupWrapper(); });draft CSS:
.piklist-field-addmore-wrapper-full { &.hide { height: 100px; overflow: hidden; } } .custom-groupwrapper { position: absolute; right: 0; a { background: none !important; border: none !important; box-shadow: none; } }
alexdParticipantanother workaround that just occurred to me is attache custom class to each field like
.show-for-blocktype-1then bind some jquery event to the blocktype select list to manually hide/show fields, rather than properly unsetting/rendering them.
I have a feeling this will fix performance, but will probably cause a mess in terms of what gets saved to DB,
unless I start adding some manual checks. And all that seems like a rabbit hole at cross purposes to piklist design pattern.
alexdParticipanthey guys, to add to this topic, I’m having the same problems here.
I have a nested addmore.
first addmore group is a ‘row’ or ‘section’
within the ‘section’ group, users can add ‘blocks’ defined by a few basic fields (text, file, editor)
In my current metabox file, a block is really one addmore group with all of the these fields.
Block ‘types’ are defined by choosing block type from a select list, and then using conditions, showing or hiding various field.I have tried defining blocks as
a) a flat list of fields, where conditions from select are applied on field by field basis
b) grouping fields which define individual ‘block’ types and applying conditions to groupDev tools is showing a lot of processing in tinymce, but replacing editor with textarea doesn’t seem to make any large difference.
A typical page will have 5-6 sections and each section 1-4 blocks.
With a page filled out with full content, without conditions, performance is acceptable.
However when I add a condition, to what looks like any field or group, and then click +/- on add more, page load (ajax processing) immediately goes up to 1-2 minutes.cachegrind shows no real difference in performance between the different scenarios, however network tab in dev tools does show 1-2 minute processing on JS.
One scenario I thought of trying is defining an aggregate custom field, one for each block type, but I haven’t looked into how to go about doing that yet, or if plugin is easily extensible in that regard (beyond simple fields).
-
AuthorPosts