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

How hide settings entry for no admin users? #66

Open
JEliasLugo opened this issue Jun 16, 2023 · 1 comment
Open

How hide settings entry for no admin users? #66

JEliasLugo opened this issue Jun 16, 2023 · 1 comment

Comments

@JEliasLugo
Copy link

Hi I love this plugin is awesome but, I recently create a no admin user and the settings for the editor apear for this user, I was wondering if has a option for hide the settings entry for no admin users, I have checked the docs and searching in other issues but I can't find nothing, someone can help me.

Captura de pantalla 2023-06-16 120632

@amiga909
Copy link

amiga909 commented Feb 6, 2024

Same problem here.

Currently I use this workaround in my post build script.

run.js

// https://github.com/dasmikko/strapi-tiptap-editor/issues/66 - How hide settings entry for no admin users?
const fs = require("fs");
const path = require("path");

const htmlFilePath = path.join(__dirname, "../../dist/build/index.html");
const cssFilePath = path.join(__dirname, "./override.css");

fs.readFile(cssFilePath, "utf8", (err, cssContent) => {
  if (err) {
    console.error("Error reading CSS file:", err);
    return;
  }

  fs.readFile(htmlFilePath, "utf8", (err, htmlContent) => {
    if (err) {
      console.error("Error reading HTML file:", err);
      return;
    }

    const modifiedHtmlContent = htmlContent.replace(
      "</head>",
      `<style>${cssContent}</style></head>`
    );

    fs.writeFile(htmlFilePath, modifiedHtmlContent, "utf8", (err) => {
      if (err) {
        console.error("Error writing back to HTML file:", err);
        return;
      }
      console.log("CSS successfully injected into HTML file.");
    });
  });
});

override.css
a[href="/admin/settings/strapi-tiptap-editor"] { display: none; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants