-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from kwinyyyc/feat/custom-config
feat: allow customizing the toolbar commands
- Loading branch information
Showing
33 changed files
with
3,533 additions
and
861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ package-lock.json | |
.DS_Store | ||
npm-debug.log | ||
.idea | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Don't check auto-generated stuff into git | ||
coverage | ||
node_modules | ||
stats.json | ||
package-lock.json | ||
|
||
# Cruft | ||
.DS_Store | ||
npm-debug.log | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* | ||
* Initializer | ||
* | ||
*/ | ||
|
||
import { useEffect, useRef } from 'react'; | ||
import pluginId from '../../pluginId'; | ||
|
||
type InitializerProps = { | ||
setPlugin: (id: string) => void; | ||
}; | ||
|
||
const Initializer = ({ setPlugin }: InitializerProps) => { | ||
const ref = useRef(setPlugin); | ||
|
||
useEffect(() => { | ||
ref.current(pluginId); | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
export default Initializer; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { prefixPluginTranslations } from "@strapi/helper-plugin"; | ||
|
||
import pluginPkg from "../../package.json"; | ||
import pluginId from "./pluginId"; | ||
import Initializer from "./components/Initializer"; | ||
import PluginIcon from "./components/PluginIcon"; | ||
import ReactMdEditor from "./components/ReactMdEditor"; | ||
|
||
const name = pluginPkg.strapi.name; | ||
|
||
export default { | ||
register(app: any) { | ||
app.addFields({ type: "wysiwyg", Component: ReactMdEditor }); | ||
const plugin = { | ||
id: pluginId, | ||
initializer: Initializer, | ||
isReady: false, | ||
name, | ||
}; | ||
|
||
app.registerPlugin(plugin); | ||
}, | ||
|
||
bootstrap(app: any) {}, | ||
|
||
async registerTrads(app: any) { | ||
const { locales } = app; | ||
|
||
const importedTrads = await Promise.all( | ||
(locales as any[]).map((locale) => { | ||
return import(`./translations/${locale}.json`) | ||
.then(({ default: data }) => { | ||
return { | ||
data: prefixPluginTranslations(data, pluginId), | ||
locale, | ||
}; | ||
}) | ||
.catch(() => { | ||
return { | ||
data: {}, | ||
locale, | ||
}; | ||
}); | ||
}) | ||
); | ||
|
||
return Promise.resolve(importedTrads); | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import pluginPkg from '../../package.json'; | ||
|
||
const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, ''); | ||
|
||
export default pluginId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import pluginId from '../pluginId'; | ||
|
||
const getTrad = (id: string) => `${pluginId}.${id}`; | ||
|
||
export default getTrad; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare module "@strapi/design-system/*"; | ||
declare module "@strapi/design-system"; | ||
declare module "@strapi/icons"; | ||
declare module "@strapi/icons/*"; | ||
declare module "@strapi/helper-plugin"; | ||
declare module "@strapi/strapi"; |
Oops, something went wrong.