1.0.44 • Published 2 months ago

webhandle-page-editor v1.0.44

Weekly downloads
2
License
ISC
Repository
github
Last release
2 months ago

Purpose

Allows editing of HTMLish pages and templates using the CKEditor

Usage

On the client side, include the scripts like:

var editing = require('webhandle-page-editor')
editing({
	configFile: '/webhandle-page-editor/std-config.js'
})

The configFile used above is a sensible default but any config file can be used. jQuery must be available as a global variable.

On the server side, if you're a webhandle user, you can include all of server side handlers like:

let pageEditingRouter = express.Router()
require('webhandle-page-editor/webhandle-integrator')(webhandle, path.join(webhandle.projectRoot, 'pages'), pageEditingRouter)

You can then secure it for admin users like:

let securedRouter = require('webhandle-users/utils/allow-group')(
	['administrators', 'page-editors'],
	pageEditingRouter
)
webhandle.routers.primary.use('/webhandle-page-editor', securedRouter)

Each page has a json file specifying certain elements. They have the general format of:

{
	"editor": {
		"propertiesTemplate": "rsf-page-properties"
		,"disablePageEditor": true
	},
	"title": "The page titel",
	"description": "The page description",
	"pageVisibility": "public",
	"socialImage": "",
}

The properties template is some view. By default, and if not specified, this is:

views/webhandle-page-editor/page-properties-editor/basic-properties.tri

"disablePageEditor" if true will cause the "E" icon not to show.

It's possible to change where the "P" icon directs to by adding something like this to the page:

<script>
	window.page = {
		editor: {
			propertiesPage: "/news-items/__newsItem._id__/edit"
		}
	}
</script>

Custom page properties

Sometimes the properties page will need data setup. This can be done by adding to the array:

webhandle.services.pageEditor.pagePropertiesPrerun

Functions added should be of the form:

async (req, res) => {
	res.locals.someVariable = await [some long running process]
}
1.0.44

2 months ago

1.0.43

6 months ago

1.0.42

6 months ago

1.0.41

6 months ago

1.0.39

7 months ago

1.0.38

7 months ago

1.0.40

7 months ago

1.0.26

11 months ago

1.0.29

10 months ago

1.0.28

11 months ago

1.0.27

11 months ago

1.0.33

10 months ago

1.0.32

10 months ago

1.0.31

10 months ago

1.0.30

10 months ago

1.0.37

7 months ago

1.0.36

7 months ago

1.0.35

7 months ago

1.0.34

7 months ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.25

12 months ago

1.0.24

12 months ago

1.0.23

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

3 years ago

1.0.9

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.8

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago