-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding a plugin for folder tree editable
- Loading branch information
1 parent
87bbf99
commit 37c4345
Showing
40 changed files
with
548 additions
and
10 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
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,7 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = false | ||
indent_style = space | ||
indent_size = 2 |
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,103 @@ | ||
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes | ||
|
||
# Handle line endings automatically for files detected as text | ||
# and leave all files detected as binary untouched. | ||
* text=auto | ||
|
||
# | ||
# The above will handle all files NOT found below | ||
# | ||
|
||
# | ||
## These files are text and should be normalized (Convert crlf => lf) | ||
# | ||
|
||
# source code | ||
*.php text | ||
*.css text | ||
*.sass text | ||
*.scss text | ||
*.less text | ||
*.styl text | ||
*.js text eol=lf | ||
*.coffee text | ||
*.json text | ||
*.htm text | ||
*.html text | ||
*.xml text | ||
*.svg text | ||
*.txt text | ||
*.ini text | ||
*.inc text | ||
*.pl text | ||
*.rb text | ||
*.py text | ||
*.scm text | ||
*.sql text | ||
*.sh text | ||
*.bat text | ||
|
||
# templates | ||
*.ejs text | ||
*.hbt text | ||
*.jade text | ||
*.haml text | ||
*.hbs text | ||
*.dot text | ||
*.tmpl text | ||
*.phtml text | ||
|
||
# git config | ||
.gitattributes text | ||
.gitignore text | ||
.gitconfig text | ||
|
||
# code analysis config | ||
.jshintrc text | ||
.jscsrc text | ||
.jshintignore text | ||
.csslintrc text | ||
|
||
# misc config | ||
*.yaml text | ||
*.yml text | ||
.editorconfig text | ||
|
||
# build config | ||
*.npmignore text | ||
*.bowerrc text | ||
|
||
# Heroku | ||
Procfile text | ||
.slugignore text | ||
|
||
# Documentation | ||
*.md text | ||
LICENSE text | ||
AUTHORS text | ||
|
||
|
||
# | ||
## These files are binary and should be left untouched | ||
# | ||
|
||
# (binary is a macro for -text -diff) | ||
*.png binary | ||
*.jpg binary | ||
*.jpeg binary | ||
*.gif binary | ||
*.ico binary | ||
*.mov binary | ||
*.mp4 binary | ||
*.mp3 binary | ||
*.flv binary | ||
*.fla binary | ||
*.swf binary | ||
*.gz binary | ||
*.zip binary | ||
*.7z binary | ||
*.ttf binary | ||
*.eot binary | ||
*.woff binary | ||
*.pyc binary | ||
*.pdf binary |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Strapi plugin tree-view-bookmarks | ||
|
||
A quick description of tree-view-bookmarks. |
27 changes: 27 additions & 0 deletions
27
plugins/tree-view-bookmarks/admin/src/containers/App/index.js
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,27 @@ | ||
/** | ||
* | ||
* This component is the skeleton around the actual pages, and should only | ||
* contain code that should be seen on all pages. (e.g. navigation bar) | ||
* | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
import { NotFound } from 'strapi-helper-plugin'; | ||
// Utils | ||
import pluginId from '../../pluginId'; | ||
// Containers | ||
import HomePage from '../HomePage'; | ||
|
||
const App = () => { | ||
return ( | ||
<div> | ||
<Switch> | ||
<Route path={`/plugins/${pluginId}`} component={HomePage} exact /> | ||
<Route component={NotFound} /> | ||
</Switch> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
31 changes: 31 additions & 0 deletions
31
plugins/tree-view-bookmarks/admin/src/containers/HomePage/index.js
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,31 @@ | ||
/* | ||
* | ||
* HomePage | ||
* | ||
*/ | ||
import SortableTree from "react-sortable-tree"; | ||
import "react-sortable-tree/style.css"; // This only needs to be imported once in your app | ||
import * as strapiHelper from "strapi-helper-plugin"; | ||
|
||
import React, { memo, useState } from "react"; | ||
// import PropTypes from 'prop-types'; | ||
|
||
const HomePage = () => { | ||
console.log(strapiHelper); // Is there an helper for getting Tree ? | ||
const treeDataInit = [ | ||
{ title: "Chicken", children: [{ title: "Egg" }, { title: "dazdaz" }] }, | ||
{ title: "coucou" }, | ||
]; | ||
const [treeData, setTreeData] = useState(treeDataInit); | ||
return ( | ||
<div style={{ height: 400 }}> | ||
<h1>Tree modifier</h1> | ||
<SortableTree | ||
treeData={treeData} | ||
onChange={(treeData) => setTreeData(treeData)} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default memo(HomePage); |
26 changes: 26 additions & 0 deletions
26
plugins/tree-view-bookmarks/admin/src/containers/Initializer/index.js
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,26 @@ | ||
/** | ||
* | ||
* Initializer | ||
* | ||
*/ | ||
|
||
import { useEffect, useRef } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import pluginId from '../../pluginId'; | ||
|
||
const Initializer = ({ updatePlugin }) => { | ||
const ref = useRef(); | ||
ref.current = updatePlugin; | ||
|
||
useEffect(() => { | ||
ref.current(pluginId, 'isReady', true); | ||
}, []); | ||
|
||
return null; | ||
}; | ||
|
||
Initializer.propTypes = { | ||
updatePlugin: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default Initializer; |
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,52 @@ | ||
import pluginPkg from '../../package.json'; | ||
import pluginId from './pluginId'; | ||
import App from './containers/App'; | ||
import Initializer from './containers/Initializer'; | ||
import lifecycles from './lifecycles'; | ||
import trads from './translations'; | ||
|
||
export default strapi => { | ||
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description; | ||
const icon = pluginPkg.strapi.icon; | ||
const name = pluginPkg.strapi.name; | ||
|
||
const plugin = { | ||
blockerComponent: null, | ||
blockerComponentProps: {}, | ||
description: pluginDescription, | ||
icon, | ||
id: pluginId, | ||
initializer: Initializer, | ||
injectedComponents: [], | ||
isReady: false, | ||
isRequired: pluginPkg.strapi.required || false, | ||
layout: null, | ||
lifecycles, | ||
mainComponent: App, | ||
name, | ||
preventComponentRendering: false, | ||
trads, | ||
menu: { | ||
pluginsSectionLinks: [ | ||
{ | ||
destination: `/plugins/${pluginId}`, | ||
icon, | ||
label: { | ||
id: `${pluginId}.plugin.name`, | ||
defaultMessage: name, | ||
}, | ||
name, | ||
permissions: [ | ||
// Uncomment to set the permissions of the plugin here | ||
// { | ||
// action: '', // the action name should be plugins::plugin-name.actionType | ||
// subject: null, | ||
// }, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
return strapi.registerPlugin(plugin); | ||
}; |
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,3 @@ | ||
function lifecycles() {} | ||
|
||
export default lifecycles; |
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,7 @@ | ||
const pluginPkg = require('../../package.json'); | ||
const pluginId = pluginPkg.name.replace( | ||
/^strapi-plugin-/i, | ||
'' | ||
); | ||
|
||
module.exports = 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 @@ | ||
{} |
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 @@ | ||
{} |
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 changes: 49 additions & 0 deletions
49
plugins/tree-view-bookmarks/admin/src/translations/index.js
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 ar from './ar.json'; | ||
import cs from './cs.json'; | ||
import de from './de.json'; | ||
import en from './en.json'; | ||
import es from './es.json'; | ||
import fr from './fr.json'; | ||
import id from './id.json'; | ||
import it from './it.json'; | ||
import ko from './ko.json'; | ||
import ms from './ms.json'; | ||
import nl from './nl.json'; | ||
import pl from './pl.json'; | ||
import ptBR from './pt-BR.json'; | ||
import pt from './pt.json'; | ||
import ru from './ru.json'; | ||
import th from './th.json'; | ||
import tr from './tr.json'; | ||
import uk from './uk.json'; | ||
import vi from './vi.json'; | ||
import zhHans from './zh-Hans.json'; | ||
import zh from './zh.json'; | ||
import sk from './sk.json'; | ||
|
||
const trads = { | ||
ar, | ||
cs, | ||
de, | ||
en, | ||
es, | ||
fr, | ||
id, | ||
it, | ||
ko, | ||
ms, | ||
nl, | ||
pl, | ||
'pt-BR': ptBR, | ||
pt, | ||
ru, | ||
th, | ||
tr, | ||
uk, | ||
vi, | ||
'zh-Hans': zhHans, | ||
zh, | ||
sk, | ||
}; | ||
|
||
export default trads; |
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 @@ | ||
{} |
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 @@ | ||
{} |
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 @@ | ||
{} |
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 @@ | ||
{} |
Oops, something went wrong.