Try our conversational search powered by Generative AI!

Disable "open in image editor" when inheriting from ImageData


I've created a content type that inherits from ImageData but I don't want the editors to be able to modify the image through the editor. Removing the edit permissions to the image doesn't seem to remove the menu option to open the image editor and only shows an "insufficient permissions" dialog when an editor tries to save the image in the editor.

Is it possible to disable/remove the option "open in image editor" from the UI for a specific content type?

Nov 07, 2018 10:39

You can turn off image editor for all type of images using web.config.

There is no supported way to turn off images only for one specific type. But I prepared a hack that you could use:

Here is the initializer (that should be registered in module.config):

], function (
) {
    return declare([module], {

        initialize: function () {

            var original = EditImage.prototype._onModelChange;
            EditImage.prototype._onModelChange = function () {
                var result = original.apply(this, arguments);

                if (!this.get("isAvailable")) {
                    return result;

                var target = this._getSingleSelectionData(),
                    canExecute = target && target.typeIdentifier !== "";

                if (!canExecute) {
                    this.set("isAvailable", false);
                    this.set("canExecute", false);
                return result;

My Tiff model looks like this:

[ContentType(GUID = "4D3B327B-4A1C-42ED-9A62-E8D4F925B8F7")]
[MediaDescriptor(ExtensionString = "tif,tiff")]
public class TiffImageFile : ImageData 
    public virtual string Copyright { get; set; }

Nov 08, 2018 22:07

That's great! Thanks for the help!

Nov 19, 2018 14:58
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.