nathanwoulfe / NestingContently

A property editor for disabling Nested Content items and Block elements in Umbraco
9 stars 8 forks source link

Panel is hidden when used inside DTGE #11

Closed bjarnef closed 5 years ago

bjarnef commented 5 years ago

At the moment there is a port of DTGE (Doc Type Grid Editor) to Umbraco v8: https://github.com/umco/umbraco-doc-type-grid-editor/pull/137

It seems when Nested Contently is used as datatype on a Doc Type, then is the panel collapsed/hidden.

Without Nested Contently datatype.

image

With Nested Contently datatype.

image

image

I guess it is an issue with one of these, where it set display:none: https://github.com/nathanwoulfe/NestingContently/blob/01625ef7aad01136dfe29825fc1188c562763053/src/NestingContently/backoffice/editor.controller.js#L12

https://github.com/nathanwoulfe/NestingContently/blob/01625ef7aad01136dfe29825fc1188c562763053/src/NestingContently/backoffice/button.component.js#L51

You can try the v8 port of DTGE, e.g. til install the zip file via backoffice installer. https://ci.appveyor.com/project/UMCO/umbraco-doc-type-grid-editor/build/artifacts

nathanwoulfe commented 5 years ago

Yup, will be due to how I'm hiding the editor - I haven't ever looked at this in DTGE.

I should probably be using a selector rather than grabbing the parent element, but will probably be better off waiting for the port to finish in case things change...

bjarnef commented 5 years ago

@nathanwoulfe this shouldn't change unless Umbraco change this in core, because DTGE is using the umb-tabbed-content component to render these panels (tabs/groups) and their properties. https://github.com/umco/umbraco-doc-type-grid-editor/blob/9a13c1ae301a90eaf18592fe94797effc334c774/src/Our.Umbraco.DocTypeGridEditor/Web/UI/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.dialog.html#L92-L94

bjarnef commented 5 years ago

Maybe it should check if the parent element has the class umb-nested-content-property-container instead?

image

image

bjarnef commented 5 years ago

Untested, but something like this might work:

const propElm = findAncestor($element[0], 'umb-property');

if (propElm) {
    var parentElem = propElm.parentElement;
    if (parentElem.classList.contains('umb-nested-content-property-container')) {
        parentElem.style.display = 'none';
    }
} 
bjarnef commented 5 years ago

I also noticed this console error.

image

wheree it seems to break here:

image

I just added Nested Content to a document type where DTGE and The Grid wasn't used. With an empty Nested Content and adding a new item, I get this console error (tested on Umbraco v8.1.0)

image

nathanwoulfe commented 5 years ago

Hi @bjarnef, pretty sure that error is coming from an old version of the directive - latest V8 compatible release has no reference to node.tabs since that no longer exists (it's all node.variant[n].tabs.

Was this a fresh install or update of an old site? Possibly an incorrect version installed?

bjarnef commented 5 years ago

@nathanwoulfe ahh I was still using the original version 1.0.6, fixed after installing v2.0.1

And this console error elementClass is not defined seems to be fixes here: https://github.com/nathanwoulfe/NestingContently/pull/10

nathanwoulfe commented 5 years ago

Glad to hear it. Wouldn't be surprised tho if there are other issues on 8.1. Let me know if anything pops up.

bjarnef commented 5 years ago

@nathanwoulfe remember to update the Umbraco package as well. Not all might use the NuGet version :) https://our.umbraco.com/packages/backoffice-extensions/nesting-contently/ https://www.nuget.org/packages/NestingContently.Umbraco/

nathanwoulfe commented 5 years ago

@bjarnef done. Not going to lie, I always forget to update the package repo... Would be awesome to have that integrated with my build...