How to use jetpack.storage.setting in Jetpack SDK 0.9 - firefox-addon

When we use Jetpack 0.6, we could manifest something like this,
var manifest = {
settings: [
{
name: "foo",
type: "group",
label: "Twitter Account",
settings: [
{ name: "twitterId", type: "text", label: "Username" },
{ name: "twitterPass", type: "password", label: "Password" }
]
}
]
};
jetpack.future.import("storage.settings");
Does anyone know how to do same thing in Jetpack SDK 0.9.
Which module should I use?

the import has changed to something like: var simpleStorage = require("simple-storage");
see: https://jetpack.mozillalabs.com/sdk/0.9/docs/#module/addon-kit/simple-storage

Related

Create Swagger Document from a Schema - using swagger-ui-express

I'm using joi-to-swagger and swagger-ui-express and I'm really struggling to find out how to get this schema to show up correctly. It's getting ignored in all scenarios and I can't find the documentation I need to correctly use the schema.
My file:
import j2s from 'joi-to-swagger'
import joi from 'joi'
import swaggerUi from 'swagger-ui-express'
const myJoiSchema = joi
.object({
text: joi.string().max(100).required(),
})
.required()
const schema = j2s(myJoiSchema).swagger
const swaggerDoc = {
swagger: '2.0',
info: {
title: 'title',
version: '1.0',
},
paths: {
'/my-url': {
post: {
summary: 'my api',
// consumes: 'application/json',
// parameters: mySchema, didn't work
requestBody: {
required: true,
schema: {
$ref: '#/components/schemas/mySchema',
},
},
},
},
},
components: {
schemas: {
mySchema: schema,
},
},
}
router.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDoc))
the schema that is produced for value schema is:
{
type: 'object',
properties: {
text: { type: 'string', maxLength: 100 },
},
required: [ 'text' ],
additionalProperties: false
}
How is the schema supposed to be properly used in the swagger doc? It might be special with swagger-ui-express but I can't confirm I've tested it correctly.

Shopware 6 add custom classes to headline tags in text editor

Is it possible to customize/extend the h1-h6 tags in the sw-text-editor with custom classes like “.headline-1” for example?
const { Component } = Shopware;
Component.override('sw-text-editor', {
props: {
buttonConfig: {
type: Array,
required: false,
default() {
return [
{
type: 'paragraph',
title: this.$tc('sw-text-editor-toolbar.title.format'),
icon: 'default-text-editor-style',
children: [
...
{
type: 'formatBlock',
name: this.$tc('sw-text-editor-toolbar.title.h1'),
value: 'h1',
tag: 'h1'
},
...
]
},
...
];
}
}
}
});
Any idea how i can add custom headline tags with specific css classes. Maybe something like this:
{
type: 'formatBlock',
name: this.$tc('sw-text-editor-toolbar.title.h1'),
value: 'h1',
tag: 'h1',
classes: 'test-class'
},

electron: how to set text on about for Darwin/OS X

I just finished my first electron package but I can't find any tutorial or example on how to set the "about" pop up on Mac OS X - Darwin.
What I have so far is
const menuTemplate = [
...(process.platform == 'darwin'? [{
label: app.getName(),
submenu: [
{role: 'about'}
]
}] : []),
{
label: "File",
submenu: [
{
label: "Save",
accelerator: "CmdOrCtrl+S",
click(){ win.webContents.send('save-clicked')}
},
{
label: "Save As",
accelerator: "CmdOrCtrl+Shift+S",
click(){
filePath = undefined
win.webContents.send('save-clicked')
}
}
]
},
{role: "editMenu"},
{role: "viewMenu"}
I assume that something has to be set after role:'about' but not sure what :)
there is actually a way to that, we need to create an another browser window rather than using the default process. Hope this will work.
const menuTemplate = [
...(process.platform == 'darwin'? [{
label: app.getName(),
submenu: [{
label: 'about',
click: () => //Do something here to create a new browser window with necessary requirement,
}]
}] : []),
{
label: "File",
submenu: [
{
label: "Save",
accelerator: "CmdOrCtrl+S",
click(){ win.webContents.send('save-clicked')}
},
{
label: "Save As",
accelerator: "CmdOrCtrl+Shift+S",
click(){
filePath = undefined
win.webContents.send('save-clicked')
}
}
]
},

ckeditor 4.7.1 not saving youtube embed code

I am trying unsuccessfully to insert embed code into my 4.7.1 ckeditor. I click on SOURCE...paste the embed code...click source again...the video shows and I can even play the video. When I go to save the "post" with text and video the only thing that remains is the text. The iframe is replaced with <p> </p>. Here is my config.js file:
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
// Set the most common block elements.
config.format_tags = 'p;h1;h2;h3;pre';
// Simplify the dialog windows.
config.removeDialogTabs = 'image:advanced;link:advanced';
config.extraAllowedContent = 'p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*};iframe(*)[*]{*}';
config.allowedContent = true;
};

How to add Wiris plugin to CKEditor?

I am having a Rails application with CKEditor integration.
I was no able to integrate the Wiris plugin into it
My config.js looks like this:
CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
config.removeButtons = 'Underline,Subscript,Superscript';
config.format_tags = 'p;h1;h2;h3;pre';
config.removeDialogTabs = 'image:advanced;link:advanced';
};
I have downloaded the Wiris plugin from here and copied it to app/assets/javascripts/ckeditor/plugins
I tried adding this in config.js file:
CKEDITOR.editorConfig = function( config )
{
config.extraPlugins += (config.extraPlugins.length == 0 ? '' : ',') + 'ckeditor_wiris';
config.toolbar_Full.push({ name: 'wiris',
items : [ 'ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS' ]});
};
But nothing seems to be working.
Any help will be appreciated!
WIRIS is now available for Ruby on Rails! You can see the CKeditor demo at http://www.wiris.com/plugins/demo/ckeditor/ruby/. You will find the links to the download and documentation on the demo page.
Our Ruby on Rails plugin is also available for TinyMCE and for generic HTML editors.

Resources