Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
code
Public Stack Site
Commits
6d1eebdf
Commit
6d1eebdf
authored
Aug 07, 2020
by
alain
🐙
Browse files
implement wysiwyg editor and other cms work
parent
f3d22b34
Changes
18
Hide whitespace changes
Inline
Side-by-side
backend/api/about/models/about.settings.json
View file @
6d1eebdf
...
...
@@ -11,6 +11,16 @@
"attributes"
:
{
"title"
:
{
"type"
:
"string"
},
"colofon"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"content.colofon-item"
},
"rows"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"content.row"
}
}
}
backend/api/alternative/models/alternative.settings.json
View file @
6d1eebdf
...
...
@@ -11,6 +11,31 @@
"attributes"
:
{
"title"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
"richtext"
},
"link"
:
{
"type"
:
"string"
},
"logo"
:
{
"model"
:
"file"
,
"via"
:
"related"
,
"allowedTypes"
:
[
"images"
,
"files"
,
"videos"
],
"plugin"
:
"upload"
,
"required"
:
false
},
"domains"
:
{
"collection"
:
"domain"
,
"via"
:
"alternative"
},
"use_cases"
:
{
"collection"
:
"use-case"
,
"via"
:
"alternative"
}
}
}
backend/api/domain/models/domain.settings.json
View file @
6d1eebdf
...
...
@@ -16,6 +16,10 @@
},
"description"
:
{
"type"
:
"richtext"
},
"alternative"
:
{
"via"
:
"domains"
,
"model"
:
"alternative"
}
}
}
backend/api/header/config/routes.json
0 → 100644
View file @
6d1eebdf
{
"routes"
:
[
{
"method"
:
"GET"
,
"path"
:
"/header"
,
"handler"
:
"header.find"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"PUT"
,
"path"
:
"/header"
,
"handler"
:
"header.update"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"DELETE"
,
"path"
:
"/header"
,
"handler"
:
"header.delete"
,
"config"
:
{
"policies"
:
[]
}
}
]
}
backend/api/
menu-item
/controllers/
menu-item
.js
→
backend/api/
header
/controllers/
header
.js
View file @
6d1eebdf
File moved
backend/api/
menu-item/models/menu-item
.js
→
backend/api/
header/models/header
.js
View file @
6d1eebdf
...
...
@@ -5,12 +5,4 @@
* to customize this model
*/
module
.
exports
=
{
lifecycles
:
{
async
afterUpdate
()
{
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
strapi
.
services
.
util
.
build
()
}
},
},
};
module
.
exports
=
{};
backend/api/header/models/header.settings.json
0 → 100644
View file @
6d1eebdf
{
"kind"
:
"singleType"
,
"collectionName"
:
"headers"
,
"info"
:
{
"name"
:
"Header"
},
"options"
:
{
"increments"
:
true
,
"timestamps"
:
true
},
"attributes"
:
{
"title"
:
{
"type"
:
"string"
,
"required"
:
true
},
"subtitle"
:
{
"type"
:
"string"
},
"primary_navigation"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"header.menu-item"
},
"secondary_navigation"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"header.menu-item"
}
}
}
backend/api/
menu-item
/services/
menu-item
.js
→
backend/api/
header
/services/
header
.js
View file @
6d1eebdf
File moved
backend/api/menu-item/config/routes.json
deleted
100644 → 0
View file @
f3d22b34
{
"routes"
:
[
{
"method"
:
"GET"
,
"path"
:
"/menu-items"
,
"handler"
:
"menu-item.find"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"GET"
,
"path"
:
"/menu-items/count"
,
"handler"
:
"menu-item.count"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"GET"
,
"path"
:
"/menu-items/:id"
,
"handler"
:
"menu-item.findOne"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"POST"
,
"path"
:
"/menu-items"
,
"handler"
:
"menu-item.create"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"PUT"
,
"path"
:
"/menu-items/:id"
,
"handler"
:
"menu-item.update"
,
"config"
:
{
"policies"
:
[]
}
},
{
"method"
:
"DELETE"
,
"path"
:
"/menu-items/:id"
,
"handler"
:
"menu-item.delete"
,
"config"
:
{
"policies"
:
[]
}
}
]
}
backend/api/use-case/models/use-case.settings.json
View file @
6d1eebdf
...
...
@@ -16,6 +16,10 @@
},
"description"
:
{
"type"
:
"richtext"
},
"alternative"
:
{
"via"
:
"use_cases"
,
"model"
:
"alternative"
}
}
}
backend/components/content/colofon-item.json
0 → 100644
View file @
6d1eebdf
{
"collectionName"
:
"components_content_colofon_items"
,
"info"
:
{
"name"
:
"colofon item"
,
"icon"
:
"child"
},
"options"
:
{},
"attributes"
:
{
"title"
:
{
"type"
:
"string"
},
"logo"
:
{
"model"
:
"file"
,
"via"
:
"related"
,
"allowedTypes"
:
[
"images"
,
"files"
,
"videos"
],
"plugin"
:
"upload"
,
"required"
:
false
},
"link"
:
{
"type"
:
"string"
}
}
}
backend/components/content/column.json
0 → 100644
View file @
6d1eebdf
{
"collectionName"
:
"components_content_columns"
,
"info"
:
{
"name"
:
"column"
,
"icon"
:
"align-justify"
},
"options"
:
{},
"attributes"
:
{
"content"
:
{
"type"
:
"richtext"
}
}
}
backend/components/content/row.json
View file @
6d1eebdf
...
...
@@ -6,10 +6,12 @@
},
"options"
:
{},
"attributes"
:
{
"text"
:
{
"type"
:
"richtext"
"columns"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"content.column"
},
"
H
eaders"
:
{
"
h
eaders"
:
{
"type"
:
"component"
,
"repeatable"
:
true
,
"component"
:
"content.header"
...
...
backend/
api/menu-item/models
/menu-item.
settings.
json
→
backend/
components/header
/menu-item.json
View file @
6d1eebdf
{
"kind"
:
"collectionType"
,
"collectionName"
:
"menu_items"
,
"collectionName"
:
"components_header_menu_items"
,
"info"
:
{
"name"
:
"Menu item"
},
"options"
:
{
"increments"
:
true
,
"timestamps"
:
true
"name"
:
"menu_item"
,
"icon"
:
"bars"
},
"options"
:
{},
"attributes"
:
{
"title"
:
{
"type"
:
"string"
...
...
@@ -17,13 +14,6 @@
},
"link"
:
{
"type"
:
"string"
},
"type"
:
{
"type"
:
"enumeration"
,
"enum"
:
[
"primary"
,
"secondary"
]
}
}
}
backend/extensions/content-manager/admin/src/components/CKEditor/index.js
0 → 100644
View file @
6d1eebdf
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
CKEditor
from
'
@ckeditor/ckeditor5-react
'
;
import
ClassicEditor
from
'
@ckeditor/ckeditor5-build-classic
'
;
import
styled
from
'
styled-components
'
;
const
Wrapper
=
styled
.
div
`
.ck-editor__main {
min-height: 200px;
> div {
min-height: 200px;
}
}
`
;
const
config
=
{
toolbar
:
[
"
undo
"
,
"
redo
"
,
"
|
"
,
"
heading
"
,
"
|
"
,
"
bold
"
,
"
italic
"
,
"
link
"
,
"
bulletedList
"
,
"
numberedList
"
,
"
|
"
,
"
indent
"
,
"
outdent
"
,
"
|
"
,
"
blockQuote
"
,
"
insertTable
"
],
heading
:
{
options
:
[
{
model
:
"
paragraph
"
,
title
:
"
Paragraph
"
,
class
:
"
ck-heading_paragraph
"
},
{
model
:
"
heading1
"
,
view
:
"
h1
"
,
title
:
"
Heading 1
"
,
class
:
"
ck-heading_heading1
"
},
{
model
:
"
heading2
"
,
view
:
"
h2
"
,
title
:
"
Heading 2
"
,
class
:
"
ck-heading_heading2
"
},
{
model
:
"
heading3
"
,
view
:
"
h3
"
,
title
:
"
Heading 3
"
,
class
:
"
ck-heading_heading3
"
},
{
model
:
"
heading4
"
,
view
:
"
h4
"
,
title
:
"
Heading 4
"
,
class
:
"
ck-heading_heading4
"
},
{
model
:
"
small
"
,
view
:
"
small
"
,
title
:
"
Small
"
,
class
:
"
ck-heading_small
"
}
]
}
}
const
Editor
=
({
onChange
,
name
,
value
})
=>
{
console
.
log
(
<
CKEditor
/>
);
return
(
<
Wrapper
>
<
CKEditor
editor
=
{
ClassicEditor
}
config
=
{
config
}
data
=
{
value
}
onChange
=
{(
event
,
editor
)
=>
{
const
data
=
editor
.
getData
();
onChange
({
target
:
{
name
,
value
:
data
}
});
}}
/
>
<
/Wrapper
>
);
};
Editor
.
propTypes
=
{
onChange
:
PropTypes
.
func
.
isRequired
,
name
:
PropTypes
.
string
.
isRequired
,
value
:
PropTypes
.
string
.
isRequired
,
};
export
default
Editor
;
\ No newline at end of file
backend/extensions/content-manager/admin/src/components/WysiwygWithErrors/index.js
0 → 100644
View file @
6d1eebdf
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
isEmpty
}
from
'
lodash
'
;
import
{
Label
,
InputDescription
,
InputErrors
}
from
'
strapi-helper-plugin
'
;
import
Editor
from
'
../CKEditor
'
;
const
WysiwygWithErrors
=
({
inputDescription
,
errors
,
label
,
name
,
noErrorsDescription
,
onChange
,
value
,
})
=>
{
let
spacer
=
!
isEmpty
(
inputDescription
)
?
(
<
div
style
=
{{
height
:
'
.4rem
'
}}
/
>
)
:
(
<
div
/>
);
if
(
!
noErrorsDescription
&&
!
isEmpty
(
errors
))
{
spacer
=
<
div
/>
;
}
return
(
<
div
className
=
"
col-12
"
style
=
{{
marginBottom
:
'
1.6rem
'
,
fontSize
:
'
1.3rem
'
,
fontFamily
:
'
Lato
'
,
}}
>
<
Label
htmlFor
=
{
name
}
message
=
{
label
}
style
=
{{
marginBottom
:
10
}}
/
>
<
Editor
name
=
{
name
}
onChange
=
{
onChange
}
value
=
{
value
}
/
>
<
InputDescription
message
=
{
inputDescription
}
style
=
{
!
isEmpty
(
inputDescription
)
?
{
marginTop
:
'
1.4rem
'
}
:
{}}
/
>
<
InputErrors
errors
=
{(
!
noErrorsDescription
&&
errors
)
||
[]}
name
=
{
name
}
/
>
{
spacer
}
<
/div
>
);
};
WysiwygWithErrors
.
defaultProps
=
{
errors
:
[],
label
:
''
,
noErrorsDescription
:
false
,
};
WysiwygWithErrors
.
propTypes
=
{
errors
:
PropTypes
.
array
,
inputDescription
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
func
,
PropTypes
.
shape
({
id
:
PropTypes
.
string
,
params
:
PropTypes
.
object
,
}),
]),
label
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
func
,
PropTypes
.
shape
({
id
:
PropTypes
.
string
,
params
:
PropTypes
.
object
,
}),
]),
name
:
PropTypes
.
string
.
isRequired
,
noErrorsDescription
:
PropTypes
.
bool
,
onChange
:
PropTypes
.
func
.
isRequired
,
value
:
PropTypes
.
string
.
isRequired
,
};
export
default
WysiwygWithErrors
;
\ No newline at end of file
backend/package.json
View file @
6d1eebdf
...
...
@@ -4,13 +4,15 @@
"version"
:
"0.1.0"
,
"description"
:
"Strapi backend for publicstack.net"
,
"scripts"
:
{
"develop"
:
"strapi develop"
,
"develop"
:
"
NODE_ENV=development
strapi develop"
,
"start"
:
"NODE_ENV=production strapi start"
,
"build"
:
"strapi build"
,
"strapi"
:
"strapi"
},
"devDependencies"
:
{},
"dependencies"
:
{
"@ckeditor/ckeditor5-build-classic"
:
"^21.0.0"
,
"@ckeditor/ckeditor5-react"
:
"^2.1.0"
,
"knex"
:
"<0.20.0"
,
"sqlite3"
:
"latest"
,
"strapi"
:
"3.0.6"
,
...
...
backend/yarn.lock
View file @
6d1eebdf
...
...
@@ -1042,6 +1042,18 @@
dependencies:
yup "^0.27.0"
"@ckeditor/ckeditor5-build-classic@^21.0.0":
version "21.0.0"
resolved "https://registry.yarnpkg.com/@ckeditor/ckeditor5-build-classic/-/ckeditor5-build-classic-21.0.0.tgz#f34624fa28edbc4de917eee326db7de1f09c9c63"
integrity sha512-IYPXmc5Np7SzJVJbGNZk3OZEHnZ/WylbN1aFyfYdKMch9Be8mrCB9QQOqfsAEKD4SjXujYvn1jL0mM/EPZ8ECw==
"@ckeditor/ckeditor5-react@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@ckeditor/ckeditor5-react/-/ckeditor5-react-2.1.0.tgz#f612546a5a328899a436d71b72ffd632600049e8"
integrity sha512-rlHjRKhwP9tNK0Yj2UJShL14mRfxLPgJ+Pv6zTv/Mvmd4wrwGnJf+5ybOAGK92S02hP1cXH+9km+PRO1b4V+ng==
dependencies:
prop-types "^15.6.1"
"@emotion/cache@^10.0.27", "@emotion/cache@^10.0.9":
version "10.0.29"
resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-10.0.29.tgz#87e7e64f412c060102d589fe7c6dc042e6f9d1e0"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment