
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
scrivito-picks
Advanced tools
A visual style picker for Scrivito boolean
, enum
, and multienum
attributes.
npm install scrivito-picks
ScrivitoPicks.createComponent
registers an editor component and returns a component name. Use this for Scrivito SDK < 1.27.0:
// HeadlineWidgetEditingConfig.js
import * as Scrivito from "scrivito";
import * as ScrivitoPicks from "scrivito-picks";
// Add a "My custom style" style picker tab to the headline widget:
Scrivito.provideEditingConfig("HeadlineWidget", {
title: "Headline",
propertiesGroups: [
{
title: "My custom style",
component: ScrivitoPicks.createComponent([
/* my custom attributes */
]),
},
],
});
With Scrivito SDK ≥ 1.27.0, ScrivitoPicks.component
can be used as an alternative. It returns a component. The properties group key
must be set:
import * as Scrivito from "scrivito";
import * as ScrivitoPicks from "scrivito-picks";
Scrivito.provideEditingConfig("HeadlineWidget", {
propertiesGroups: [
{
title: "My custom style",
key: "my-custom-style",
component: ScrivitoPicks.component([
/* ... */
]),
},
],
});
Both createComponent
and component
take a single argument.
attributes
- An array of attribute options [{attribute: 'myEnum', values: ... }, ...]
. For a single attribute, a plain attribute options object can be passed instead of a one-element array.
An object describing how an attribute is presented.
Option | Description |
---|---|
attribute | The attribute name. |
values | An array describing the available items and their representation. See value properties. |
title | The attribute title. If false , no title will be shown. Default: the sentence cased attribute name. |
previewClassName | A callback returning the className of a value preview element. |
previewStyle | A callback returning the style of a value preview element. |
previewText | A callback returning the inner text (or component) of a value preview element. |
renderPreview | A render callback for a value preview. If set, preview* options are ignored. |
thumbnail | A callback returning the URL of the thumbnail image for a value. |
If an option has a static value, you can use a string (or an object for the previewStyle
property) instead of a callback.
An object that describes an attribute value. Individual attribute options can be overridden per value.
Property | Description |
---|---|
value | The attribute value. |
title | The attribute title shown to the user. Default: the sentence cased value. |
previewClassName | Override the previewClassName for this value. |
previewStyle | Override the previewStyle for this value. |
previewText | Override the previewText for this value. |
renderPreview | Override the renderPreview callback for this value. |
thumbnail | Override the thumbnail for this value. |
Many options can be configured as a callback. The callback receives an object with the following parameters:
Parameter | Description |
---|---|
value | The attribute value of the item. |
page | The Scrivito.Obj containing the edited attribute. undefined when editing a widget. |
widget | The Scrivito.Widget containing the edited attribute. undefined when editing a page. |
content | Convenience parameter for (page || widget) . |
// Create a picker for the `alignment` enum attribute.
// There are three options, each option is represented by a Font Awesome icon.
component: ScrivitoPicks.createComponent({
attribute: 'alignment',
values: [
{ value: 'left', previewClassName: 'fa fa-4x fa-align-left' },
{ value: 'center', previewClassName: 'fa fa-4x fa-align-center' },
{ value: 'right', previewClassName: 'fa fa-4x fa-align-right' },
],
}),
// Same as the first example, but with custom options titles.
// The Font Awesome icon is computed by a callback.
component: ScrivitoPicks.createComponent({
attribute: "alignment",
previewClassName: ({ value }) => `fa fa-4x fa-align-${value}`,
title: "Horizontal alignment",
values: [
{ value: "left", title: "Left aligned" },
{ value: "center", title: "Centered" },
{ value: "right", title: "Right aligned" },
],
});
// Render custom preview components:
component: ScrivitoPicks.createComponent({
attribute: "alignment",
values: [{ value: "left" }, { value: "center" }, { value: "right" }],
renderPreview: ({ value }) => <i className={`fa fa-4x fa-align-${value}`} />,
});
// Create a picker for two attributes, `alignment` and `style`:
component: ScrivitoPicks.createComponent([
{
attribute: "alignment",
values: [
{ value: "left", previewClassName: "fa fa-4x fa-align-left" },
{ value: "center", previewClassName: "fa fa-4x fa-align-center" },
{ value: "right", previewClassName: "fa fa-4x fa-align-right" },
],
},
{
attribute: "style",
title: "Heading style",
values: [
{
value: "h1",
title: "Level 1 heading",
previewClassName: "fa fa-4x fa-h1",
},
{
value: "h2",
title: "Level 2 heading",
previewClassName: "fa fa-3x fa-h2",
},
{
value: "h3",
title: "Level 3 heading",
previewClassName: "fa fa-2x fa-h3",
},
],
},
]);
FAQs
A visual style picker for Scrivito detail views
The npm package scrivito-picks receives a total of 472 weekly downloads. As such, scrivito-picks popularity was classified as not popular.
We found that scrivito-picks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.