npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webhandle-page-editor

v1.0.51

Published

Edit web pages

Downloads

78

Readme

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]
}