Removing fonts from textboxio - wysiwyg

Oh holy Textboxio,
How do I remove the font faces from the toolbar ui without removing the color, highlights and font size?
I just want the following fonts to display if it can't be removed...
{ "value" : "Arial", "display" : "Arial" },
{ "value" : "Arial Black", "display" : "Arial Black" },
{ "value" : "Arial Narrow", "display" : "Arial Narrow" },
{ "value" : "Helvetica", "display" : "Helvetica" },
{ "value" : "Impact", "display" : "Impact" },
{ "value" : "Lucida Grande", "display" : "Lucida Grande" },
{ "value" : "Tahoma", "display" : "Tahoma" },
{ "value" : "Trebuchet MS", "display" : "Trebuchet MS" },
{ "value" : "Verdana", "display" : "Verdana" },
{ "value" : "Courier New", "display" : "Courier New" },
{ "value" : "Georgia", "display" : "Georgia" },
{ "value" : "Palatino Linotype", "display" : "Palatino Linotype" },
{ "value" : "Times New Roman", "display" : "Times New Roman" },
{ "value" : "Century Gothic", "display" : "Century Gothic" }

We don't have an API to configure the font list (yet). You can create a new menu that looks the same, but you'll lose access to future changes we make (sup/sub/strike were added in 1.2).
More info is available in our Changing the toolbar article and the specific toolbar config documentation, but this config will do it:
var customFontMenu = {
id : 'font',
label : 'Font Menu', // note this is not translated, the real menu is
items : [ 'font-size', 'font-color', 'superscript', 'subscript', 'strikethrough' ]
};
var config = {
ui : {
toolbar : {
items : ['undo', 'insert', 'style', 'emphasis', 'align', 'listindent', [ customFontMenu, 'removeformat' ], 'tools' ]
}
}
};
var editor = textboxio.replace('#targetId', config);
I also suggest logging a ticket in our support system so we can add your name to the font list configurability task.

Font customisation has been included with our version 1.3 release:
http://docs.ephox.com/display/tbio/fonts

Until I get a fix from ephox, I'll detach the fonts from the plugin.

Related

sap.m.TileContainer Only Displays 2 Tiles

I'd like to use sap.m.TileContainer to display tiles with some info. The SAP sample is not really useful as it does not follow the guidelines such as using manifest.json etc...
So I built an app in SAP Web IDE from scratch. I am using TileContainer to display tiles. Its tile aggregation is bound to a local JSON data file.
The data file contains an array with three items. However, only two are displayed after rendering. Any suggestions why?
This is my data.json:
{
"TileCollection": [{
"title": "Slovenská Republika",
"info": "support for SR",
"flag": "",
"icon": "sap-icon://inbox"
}, {
"title": "Deutschland",
"info": "support for DE",
"flag": "",
"icon": "sap-icon://inbox"
}, {
"title": "Ceska Republika",
"info": "support for CZ",
"flag": "",
"icon": "sap-icon://inbox"
}]
}
This is my XML view:
<mvc:View
controllerName="com.support_page.controller.App"
height="100%"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:tnt="sap.tnt"
xmlns="sap.m">
<Page
showHeader="true"
enableScrolling="false">
<TileContainer
id="container"
tileDelete="handleTileDelete"
tiles="{/TileCollection}">
<StandardTile
icon="{icon}"
title="{title}"
info="{info}"
activeIcon="{flag}"/>
</TileContainer>
</Page>
</mvc:View>
many thanks for your suggestion
in the meantime i solved it with tile container as well.
what i did is that i used NOT a default model.
i initialised the model in component.js
then used model>/TileCollection and it worked though i am still a bit confused.
nevertheless, thanks for you answer as well.
I solved this issue , even i was facing same issue , If you dont use local model you will not face issue or if you define your model in controller you will not face the issue.
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel"
], function(Controller,JSONModel) {
"use strict";
return Controller.extend("SmartPurchaseReq.controller.Home", {
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* #memberOf SmartPurchaseReq.view.Home
*/
onInit: function() {
var that = this;
var data = {
"TileCollection" : [
{
"icon" : "sap-icon://hint",
"type" : "Monitor",
"title" : "Tiles: a modern UI design pattern for overview & navigation."
},
{
"icon" : "sap-icon://inbox",
"number" : "89",
"title" : "Approve Leave Requests",
"info" : "Overdue",
"infoState" : "Error"
},
{
"type" : "Create",
"title" : "Create Leave Requests",
"info" : "28 Days Left",
"infoState" : "Success"
},
{
"icon" : "sap-icon://travel-expense-report",
"number" : "281",
"numberUnit" : "euro",
"title" : "Travel Reimbursement",
"info" : "1 day ago"
},
{
"icon" : "sap-icon://loan",
"number" : "2380",
"numberUnit" : "euro",
"title" : "My Salary",
"info" : "8 days ago"
},
{
"icon" : "sap-icon:`enter code here`//lab",
"number" : "1",
"numberUnit" : "Invention",
"title" : "Test Lab Reports",
"info" : "8 Days Ago"
},
{
"icon" : "sap-icon://inbox",
"type" : "Monitor",
"title" : "Leave Request History"
},
{
"type" : "Create",
"title" : "Create Purchase Order",
"info" : "890€ Open Budget",
"infoState" : "Success"
},
{
"icon" : "sap-icon://stethoscope",
"number" : "3",
"title" : "Yearly Health Check",
"info" : "3 year overdue",
"infoState" : "Error"
},
{
"icon" : "sap-icon://meal",
"type" : "Monitor",
"title" : "Meal Schedule"
}
]
};
var DummyModel = new JSONModel();
DummyModel.setData(data);
// var sPath = jQuery.sap.getModulePath("model", "/Dummy.json");
// var DummyModel = new JSONModel(sPath);
that.getView().byId("container").setModel(DummyModel);
},
OnTilePress: function(evt) {
var idj = evt.getSource();
var d =5;
}
/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* #memberOf SmartPurchaseReq.view.Home
*/
// onBeforeRendering: function() {
//
// },
/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* #memberOf SmartPurchaseReq.view.Home
*/
// onAfterRendering: function() {
//
// },
/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* #memberOf SmartPurchaseReq.view.Home
*/
// onExit: function() {
//
// }
});
});

Why does MapReduce return undefined for a field that exists in document?

I am trying to debug a strange issue I am running into while running mapreduce on a collection:
For reference, here's a single document from the collection:
{
"_id" : "ITOUXFWgvWs",
"source" : "youtube",
"insert_datetime" : ISODate("2017-04-06T22:27:43.598Z"),
"processed" : false,
"raw" : {
"id" : "ITOUXFWgvWs",
"etag" : "\"m2yskBQFythfE4irbTIeOgYYfBU/hiQtS6aptLlqxTpsYp1EJIRcoZo\"",
"snippet" : {
"publishedAt" : ISODate("2017-04-06T13:25:28Z"),
"title" : "Alarm.com: The Only Smart Home App You Need",
"channelId" : "UC_HZfoZUP36STk7SrtKYH4g",
"description" : "All these new connected devices are awesome, but wouldn’t it be great if you could use one app for the entire connected home? It can all come together with Alarm.com.",
"categoryId" : "28",
"channelTitle" : "Alarm.com",
"thumbnails" : {
"default" : {
"height" : 90,
"width" : 120,
"url" : "https://i.ytimg.com/vi/ITOUXFWgvWs/default.jpg"
},
"standard" : {
"height" : 480,
"width" : 640,
"url" : "https://i.ytimg.com/vi/ITOUXFWgvWs/sddefault.jpg"
},
"high" : {
"height" : 360,
"width" : 480,
"url" : "https://i.ytimg.com/vi/ITOUXFWgvWs/hqdefault.jpg"
},
"medium" : {
"height" : 180,
"width" : 320,
"url" : "https://i.ytimg.com/vi/ITOUXFWgvWs/mqdefault.jpg"
},
"maxres" : {
"height" : 720,
"width" : 1280,
"url" : "https://i.ytimg.com/vi/ITOUXFWgvWs/maxresdefault.jpg"
}
},
"liveBroadcastContent" : "none",
"localized" : {
"title" : "Alarm.com: The Only Smart Home App You Need",
"description" : "All these new connected devices are awesome, but wouldn’t it be great if you could use one app for the entire connected home? It can all come together with Alarm.com."
}
},
"contentDetails" : {
"duration" : "PT37S",
"dimension" : "2d",
"definition" : "hd",
"licensedContent" : false,
"projection" : "rectangular",
"caption" : "false"
},
"kind" : "youtube#video",
"statistics" : {
"likeCount" : "0",
"dislikeCount" : "0",
"favoriteCount" : "0",
"viewCount" : "32"
},
"uploaded" : ISODate("2017-04-06T13:25:28Z")
},
}
I am literally following the mapreduce debug steps from official mongo documentation.
Here's what my mapreduce script looks like:
var map = function() {
emit("1", this._id);
};
var emit = function(key, value) {
print("emit");
print("key: " + key + " value: " + tojson(value));
}
var myDoc = db.getCollection("abc").find({}).limit(1);
map.apply(myDoc);
And it always produces the result like this:
MongoDB shell version: 2.4.6
connecting to: test
emit
key: 1 value: undefined
I expect the script to emit the _id since it clearly exists in the document but it doesn't.
What might be possible cause of this?
find() always returns a cursor.
Replace it with findOne()
var myDoc = db.getCollection("abc").findOne({});
Or store the documents in an Array using toArray()
var myDoc = db.getCollection("abc").find({}).limit(1).toArray()[0];

Mongodb field value as another field

I just want to get filed value where field is value of another filed.
ex: below I want to get valueOf("Brand")="Toshiba" where "Brand" is value of field mappingData.brand
{
"_id" : ObjectId("5640bdec1b988de0be317251"),
"Part number" : "PS460E-04NVX-NL",
"Brand" : "Toshiba",
"Quality" : "XYZ",
"Category" : "notebooks",
"Model Name" : "Satellite Pro 4600 PIII900",
"EAN" : "",
"Market Presence" : "N",
"Family" : "",
"Title" : "Toshiba Satellite Pro 4600 PIII900",
"mapping" : {
"brand" : "Brand",
"title" : "Title"
}
}
I am trying this following way but it is returning undefined.
db.products.find().limit( 5 ).forEach(function(myDoc) {
var b=myDoc.mappingData.brand;
print(myDoc.$$b);
})
Please help to resolve this issue.
Use the bracket notation to access the property of an object. In your case, this would be
db.products.find().limit(5).forEach(function(myDoc) {
var brand = myDoc.mappingData.brand,
brandVal = myDoc[brand];
print(brandVal);
})

In mongodb is it possible to query by sub-object?

I have an doc in mongo:
{
"_id" : ObjectId("54eb5189ad9685bbb622ca52"),
"header" : {
"title" : "Project Name 1",
"header_img" : "project_name_1.png",
"project_stats" : {
"sqFt" : 20000,
"tons" : 300,
"duration" : "6 months",
"type" : "education facility",
"summary" : "Give quick summary of problem solved."
}
},
"row_project_detail" : {
"project_logo" : "project_name_1_logo.png",
"header" : "Project Name 1 was a project where...",
"paragraph" : "blah blah blah blah"
},
"row_1" : {
"img" : "project_name_2.png"
},
"row_2" : {
"img_1" : "project_name_3.png",
"img_2" : "project_name_4.png"
},
"row_3" : {
"img" : "project_name_5.png"
},
"row_4" : {
"img" : "project_name_6.png"
}
}
I have tried to query by db.projects.find({ header: { title: "Project Name 1"} }); but it does not produce results. How can I query by the title key in the header object? Is this possible or do I simply need to duplicate the title key from the header sub-object and put that at the root of the doc?
Use dot notation:
db.projects.find({ "header.title": "Project Name 1"});

jstree - Cannot set icons when using types plugin

I'm trying to display a jstree containing sections and the pages that they contain.
I've set up a type for each but I can't get the icon to change for the page type, it just keeps displaying the default folder icon.
This is my javascript:
$('#demo1').jstree({
"themes" : {
"theme" : "default",
"dots" : false,
"icons" : true
},
"types" : {
"section" : {
"max_children" : -1,
"max_depth" : -1,
"valid_children": "all",
"type_attr" : "section"
},
"page" : {
"max_children" : 0,
"max_depth" : -1,
"valid_children": "none",
"icon" : {
"image" : "http://static.jstree.com/v.1.0rc/_docs/_drive.png"
},
"type_attr" : "page"
}
},
"core" : {"html_titles" : true, "load_open" : true },
"plugins" : [ "themes", "json_data", "ui", "cookies", "crrm", "sort", "types" ],
"json_data" : {
"ajax" : {
"type": 'GET',
"url" : function (node) {
var url = ""
if (node == -1)
{
url = 'localhost/sections';
}
else
{
url = 'localhost/sections/'+node.attr("id");
}
return url;
},
"type" : "get",
"success" : function(items) {
data = []
for (i in items) {
var item = items[i]
var type;
if (JSON.stringify(items[i].root)) {
type = "section";
node = {
"data" : item.title,
"attr" : { "id" : item.id, "rel" : type },
"state" : "closed"
}
} else {
type = "page";
node = {
"data" : item.title,
"attr" : { "rel" : type },
"state" : "open"
}
}
this.set_type(type, node);
data.push(node);
}
return data;
}
}
}
});
This is the HTML generated by the AJAX call.
<div id="demo1" class="demo jstree jstree-0 jstree-focused jstree-default" style="height:100px;">
<ul class="jstree-no-dots">
<li id="1" rel="section" class="jstree-open">
<ins class="jstree-icon"> </ins><ins class="jstree-icon"> </ins>One
<ul>
<li id="3" rel="section" class="jstree-closed"><ins class="jstree-icon"> </ins><ins class="jstree-icon"> </ins>One Subsection</li>
<li rel="page" class="jstree-open jstree-last"><ins class="jstree-icon"> </ins><ins class="jstree-icon"> </ins>Page in section one</li>
</ul>
</li>
<li id="2" rel="section" class="jstree-closed jstree-last"><ins class="jstree-icon"> </ins><ins class="jstree-icon"> </ins>Two</li>
</ul>
</div>
Can anyone see what's going wrong?
Any advice appreciated.
Thanks
Not sure if this answer is still useful but I've been having similar problems with jsTree and I found your question
Aare you sure this config is right? You have:
"types" : {
"section" : {
"max_children" : -1,
"max_depth" : -1,
"valid_children": "all",
"type_attr" : "section"
},
"page" : {
"max_children" : 0,
"max_depth" : -1,
"valid_children": "none",
"icon" : {
"image" : "http://static.jstree.com/v.1.0rc/_docs/_drive.png"
},
"type_attr" : "page"
}
I think it should be
"types" : {
"type_attr" : "rel", // you can remove this. the rel attribute is the default
"types" : {
"section" : {
"max_children" : -1,
"max_depth" : -1,
"valid_children": "all"
},
"page" : {
"max_children" : 0,
"max_depth" : -1,
"valid_children": "none",
"icon" : {
"image" : "http://static.jstree.com/v.1.0rc/_docs/_drive.png"
}
}
}
Notice that the Types object contains some properties (the type_attr option) and it also contains a nested Types property which includes each type.
Based on the docs I've read, the jsTree lib looks in the type_attr and gets the node's value and compares it to the list of values in Types.Types
for those here using 3.0, its different now.
from this issue: https://github.com/vakata/jstree/issues/497
The type is not read off of the rel attribute. Try using <li data-jstree='{ "type" : "floor" }'... in your markup (and keep the single quotes outside, and the double quotes - inside for the data-jstree attribute).`
so the key is
<li data-jstree='{ "type" : "section" }'>...</li>