Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing command in configuration of richtext editor #14405

Open
bjarnef opened this issue Jun 18, 2023 · 10 comments
Open

Missing command in configuration of richtext editor #14405

bjarnef opened this issue Jun 18, 2023 · 10 comments

Comments

@bjarnef
Copy link
Contributor

bjarnef commented Jun 18, 2023

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

12.1.0-rc

Bug summary

When registering multiple command in richtext editor via appsettings.json it seems the first one isn't shown.

"RichTextEditor": {
  "Commands": [
    {
      "Alias": "forecolor",
      "Name": "Text color",
      "Mode": "Selection"
    },
    {
      "Alias": "hilitecolor",
      "Name": "Background color",
      "Mode": "Selection"
    },
    {
      "Alias": "blockquote",
      "Name": "Blockquote",
      "Mode": "Selection"
    },
    {
      "Alias": "wordcount",
      "Name": "Word count",
      "Mode": "All"
    },
    {
      "Alias": "emoticons",
      "Name": "Emoticons",
      "Mode": "All"
    },
    {
      "Alias": "template",
      "Name": "Template",
      "Mode": "All"
    },
    {
      "Alias": "codesample",
      "Name": "Code sample",
      "Mode": "All"
    }
  ],
  "Plugins": [
    "textcolor",
    "colorpicker",
    "codesample",
    "emoticons",
    "template",
    "wordcount"
  ]
}

I would have expected text color command to be shown. If I move block quote as first object, this is the one not shown.

image

Specifics

No response

Steps to reproduce

Add configuration of richtext editor via appsettings.json as shown above.
Notice text color (forecolor) isn't shown.

image

If block quote command is moved to first object, it is the one not being shown, while the text color command is shown.

Expected result / actual result

No response

@github-actions
Copy link

Hi there @bjarnef!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@bjarnef
Copy link
Contributor Author

bjarnef commented Jun 18, 2023

@bergmania any idea why "fore color" isn't mapped server side as shown in #14405 (comment)

if I move "block quote" to first object command in RichTextEditor in appsettings.json then "fore color" is shown, but "block quote" is not.
Is there any logic skipping first element from configuration?

However we have a working project on v11.4 where we only have a single custom command "block quote" which is shown as expected.

@Zeegaan
Copy link
Member

Zeegaan commented Jun 20, 2023

@bjarnef this is me on the contrib branch, works like a charm 🤔

my appsettings.json

"RichTextEditor": {
  "Commands": [
    {
      "Alias": "forecolor",
      "Name": "Text color",
      "Mode": "Selection"
    },
    {
      "Alias": "hilitecolor",
      "Name": "Background color",
      "Mode": "Selection"
    },
    {
      "Alias": "blockquote",
      "Name": "Blockquote",
      "Mode": "Selection"
    },
    {
      "Alias": "wordcount",
      "Name": "Word count",
      "Mode": "All"
    },
    {
      "Alias": "emoticons",
      "Name": "Emoticons",
      "Mode": "All"
    },
    {
      "Alias": "template",
      "Name": "Template",
      "Mode": "All"
    },
    {
      "Alias": "codesample",
      "Name": "Code sample",
      "Mode": "All"
    }
  ],
  "Plugins": [
    "textcolor",
    "colorpicker",
    "codesample",
    "emoticons",
    "template",
    "wordcount"
  ]
},

@Zeegaan Zeegaan added the state/needs-investigation This requires input from HQ or community to proceed label Jun 20, 2023
@bjarnef
Copy link
Contributor Author

bjarnef commented Jun 20, 2023

@Zeegaan hmm strange 🤔
are you sure the first command "forecolor" is shown at toolbar checkboxes?

@Zeegaan
Copy link
Member

Zeegaan commented Jun 20, 2023

Forgot to post the screenshot sorry 🙈

Isn't it the one I've circled here 🤔

image

@bjarnef
Copy link
Contributor Author

bjarnef commented Jun 20, 2023

@Zeegaan yes, it it.

Now I have pulled latest changes from contrib branch and rebuild.

"RichTextEditor": {
  "Commands": [
    {
      "Alias": "forecolor",
      "Name": "Text color",
      "Mode": "Selection"
    },
    {
      "Alias": "hilitecolor",
      "Name": "Background color",
      "Mode": "Selection"
    },
    {
      "Alias": "blockquote",
      "Name": "Blockquote",
      "Mode": "Selection"
    },
    {
      "Alias": "wordcount",
      "Name": "Word count",
      "Mode": "All"
    },
    {
      "Alias": "emoticons",
      "Name": "Emoticons",
      "Mode": "All"
    },
    {
      "Alias": "template",
      "Name": "Template",
      "Mode": "All"
    },
    {
      "Alias": "codesample",
      "Name": "Code sample",
      "Mode": "All"
    }
  ],
  "Plugins": [
    "textcolor",
    "colorpicker",
    "codesample",
    "emoticons",
    "template",
    "wordcount"
  ]
} 

image

@bjarnef
Copy link
Contributor Author

bjarnef commented Jun 20, 2023

@Zeegaan although you have "Text color", "Background color" and "Blockquote" you are missing the "Full Screen" option, which is strange since it's a core command.

I also tried change IOptions<RichTextEditorSettings> to IOptionsMonitor<RichTextEditorSettings> in RichTextPreValueController, but it didn't seem to be a difference to the checkbox options listed.

By default is should be the last one, before any custom commands configured.

image

I searched the codebase, but couldn't find where it merged custom commands and core commands server side. I think there may be something that isn't correct.

@Zeegaan
Copy link
Member

Zeegaan commented Jun 21, 2023

I think it gets merged/mapped here in rte.prevalues.controller.js 🤔
image

@Zeegaan Zeegaan added community/up-for-grabs area/frontend affected/v12 and removed state/needs-investigation This requires input from HQ or community to proceed labels Jun 21, 2023
@github-actions
Copy link

Hi @bjarnef,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@bjarnef
Copy link
Contributor Author

bjarnef commented Jun 21, 2023

Hi @Zeegaan
Not it is mapped server side, see the debugging here, where "forecolor" is missing: #14405 (comment)

In the prevalue editor controller it just extend the object with additional properties.

while debugging the "forecolor" command was also missing from collection here:

settings.Commands.Select(x =>
new RichTextEditorCommand { Alias = x.Alias, Mode = x.Mode, Name = x.Name }),

but I couldn't find where data is populated to settings.Commands collection.
If it directly map from appsettings.json it is strange it is missing "forecolor" command in my case, and in your case "fullscreen" command.

@bjarnef bjarnef changed the title First command not shown in configuration of richtext editor Missing command in configuration of richtext editor Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants