dawoe / OEmbed-Picker-Property-Editor

Property editor for Umbraco CMS to allow embedding 3rd party media like Youtube, Vimeo, ... outside of the rich text editor.
https://our.umbraco.org/projects/backoffice-extensions/oembed-picker-property-editor/
MIT License
10 stars 10 forks source link

added the 'hide dimensions' property to the editor #6

Closed ribsdigital closed 3 years ago

ribsdigital commented 4 years ago

hi dave,

i've been using the plugin in a number of projects now and it works a treat!

one request i've had though is to remove the dimension properties from the embed dialog as nearly all the sites i've used the plugin on are responsive and therefore the dimensions are controlled by the front end...

so i had a play and found the easiest way to get around this was to add a new property to the datatype setting a bool value for hiding the dimensions.

i then took the embed infinate editor view and code from the umbraco core and updated it to show/hide the dimensions based on the property editor value.

i've given it a good test through in the project i'm working on and so far, so good!

if you could take a look at the code and let me know if it'd be good to merge in for the next release, that'd be amazin ;)

oh, and one other minor tweak: i updated the editor to only output the sorting handle if the editor allows multiple items and has more than 1 item.

ribsdigital commented 4 years ago

hey dave,

thanks for taking a look through the pr ;)

so, i've dug through the https://github.com/umbraco/Umbraco-CMS/issues/4178 issue and code in the v8.2.0 branch of umbraco but i can't see something that would allow me to pass a value to the embed dialog that'd mean the dimensions wouldn't come out...

there is code to set the supportsDimensions value on line 84 of the src\Umbraco.Web.UI.Client\src\views\common\infiniteeditors\embed\embed.controller.js file:

$scope.model.embed.supportsDimensions = response.data.SupportsDimensions;

which is then used in the view to show/hide the dimensions in the src\Umbraco.Web.UI.Client\src\views\common\infiniteeditors\embed\embed.html view:

<div ng-show="model.embed.supportsDimensions && model.embed.success">

however the value set for response.data.SupportsDimensions is hardcoded to true on line 57 of the src\Umbraco.Web\PropertyEditors\RteEmbedController.cs controller:

try
{
    result.SupportsDimensions = true;
    result.Markup = matchedProvider.GetMarkup(url, width, height);
    result.OEmbedStatus = OEmbedStatus.Success;
}

totally agree that using a core editor rather than a custom one would be the best but i just can't see where the setting would be controlled...

what am i missing?!

dawoe commented 4 years ago

Ah... I know in V7 you could set this through the embedded media config file. So I think a issue should be raised for V8 to make this possible again.

Dave

ribsdigital commented 4 years ago

interesting... i did some more digging and found a post that you'd contributed to!

https://our.umbraco.com/forum/using-umbraco-and-getting-started/99236-override-embed-provider-configuration

so yup, it appears you used to be able to configure it but now it's hardcoded to true...

that's a bit of a bloody pain!

dawoe commented 3 years ago

Hi @ribsdigital

this response is long overdue. Sorry for that.

I wil close this one and see if I can fix this in Umbraco Core. Because I think that is where this should be fixed