How to Setup NativeControls in Xcode 4? - xcode

I'm building another application for iOS and this time I would like to go more native with PhoneGap, so I saw NativeControls and I loved the plugin features, but how do I get it setup on a Xcode 4 project? I haven't seen any tutorials about this.

First, you must reference the NativeControls.js file in your html page after including it in the www folder. Make sure that this file is located AFTER the phonegap.js file in your html. Next, add the .m & .h files in the plugins folder. Last, add NativeControls as a key in the phonegap.plist file, setting value as string. Also keep in mind this plugin only works for the iPhone.
You may also try checking out http://hiediutley.com/2011/03/30/phonegap-tutorial-series-%E2%80%93-5-third-party-plugins-nativecontrols/

Include NativeControls.js in www folder, and NativeControls.h and NativeControls.m files in Plugins folder in Project. In the Cordova plist file add a key value pair under the item called 'Plugins' as 'NativeControls' (key name and value: NativeControls).
If you are using Native Controls for tab bar, place the following in the onDeviceReady function:
nativeControls = window.plugins.nativeControls;
nativeControls.createTabBar();
// First tab
nativeControls.createTabBarItem(
"tab1",
"Tab1", //Name that appears on tab item
"....png", //Tab image placed in Resources folder
{ "onSelect": function() {}}
);
// Second tab
nativeControls.createTabBarItem(
"tab2",
"Tab2",
"....png", //Tab image placed in Resources folder
{ "onSelect": function() {}}
);
// Third tab
nativeControls.createTabBarItem(
"tab3",
"Tab3",
"....png", //Tab image placed in Resources folder
{ "onSelect": function() {}}
);
// Compile the TabBar
nativeControls.showTabBar();
nativeControls.showTabBarItems("tab1", "tab2", "tab3");
nativeControls.selectTabBarItem("books");

Related

How can I allow for image insertion via URL but not uploading?

I'm using CKEditor and I want to allow people to place images by using a URL, but not upload. I can't figure out how to accomplish that. My toolbar is:
toolbar: {
items: [
'heading','|','bold','italic','link','bulletedList','numberedList','|','indent','outdent','alignment','|','HorizontalLine','ImageInsert','BlockQuote','InsertTable','MediaEmbed','Undo','Redo','|','FontColor','FontSize','Strikethrough','Subscript','Superscript'
]
},
Originally it had 'ImageUpload', so I removed that thinking it would work yet the image icon for ImageInsert, when clicked directly, opens the browser file dialog for an upload. You have to hit the down arrow to get the URL. What should I change it to such that clicking the icon opens the URL dialog directly?
Thanks!
PS, I inherited this, I didn't make it initially and as such I have no idea what version of CK it is nor how to determine that, sorry.
Try This :
CKEDITOR.editorConfig = function( config ) {
....
config.removePlugins = 'easyimage, cloudservices';
....
};
Then click on image tab on Editor and insert your Image Url In Url Field

VuePress Sidebar incorrectly rendering

I was looking for a solution to automatic generation of the VuePress sidebar and found this module which was recommended in this tutorial - solution2
I'm trying to get it working as described however the sidebar displays the actual folder path to the html rather than just the name as can be seen below, i've tried a different folder structure, adding and removing MD files but i cannot get the sidebar to display correctly. Would anyone know how I can fix this / what i've done wrong?
Config.js:
const getConfig = require("vuepress-bar");
module.exports = {
title: 'Hello VuePress',
description: 'Just playing around',
themeConfig: {
...getConfig(`${__dirname}/..`)
}
}
Sidebar result :
I fixed this by adding the correct front matter to my MD files, title and permalink

How to automatically add a class to images in the body field in CKeditor

I would like the ability to add a class to images which are added to the body field in Drupal.
I want to keep things as simple as possible for our users, whereby they don't have to add classes etc. Ideally they would just click on the image button in the toolbar, paste the URL or upload an image and set align either left or right:
Image properties for adding images in CKeditor
I've tried several options, including: CKEditor adding class to img tag but I cannot get anything to work.
The path to CKEditor is to the CDN //cdn.ckeditor.com/4.5.4/full-all
I'd like to us my own SCSS to make the images float left or right at desktop, and be centered for the small breakpoint.
The text format is 'filtered HTML'.
Is there any way I can get this to work?
Many Thanks
Update
Because I'm using the CKEditor CDN, I've added the following to my local 'ckeditor.config.js' file
config.extraPlugins = 'image, dialog, dialogui';
// Enable local "imagetoolbar" plugin from /myplugins/imagetoolbar/ folder.
CKEDITOR.plugins.addExternal( 'image', '/plugins/image/' 'plugin.js' );
CKEDITOR.plugins.addExternal( 'dialog', '/plugins/dialog/' 'plugin.js' );
CKEDITOR.plugins.addExternal( 'dialogui', '/plugins/dialog/' 'plugin.js' );
// extraPlugins needs to be set too.
CKEDITOR.replace( 'news', {
extraPlugins: 'image, dialog, dialogui'
} );
The example I copied this from has 'news' as the CKEDITOR.replace, which I'm sure is wrong, what should this be? https://www.pluginsforckeditor.com/Tutorials/149/How-to-add-a-plugin-to-CKEditor/en/n149.aspx
You can modify the image plugin in order to have the class of the image already entered. So users just have to paste URL or upload an image.
Fill the default field with what you want.
I hope to help you.

dropzone.js: Only use file drop only with no output

I have an existing file upload (manual) in my web application. My application already shows existing uploaded files and a way to delete files.
I would like to incorporate the dropzone.js drag and drop into a small target area - but that is all. I don't want dropzone to print/render anything back to the screen - no messages, no images, nothing.
Could someone provide and example of how to configure dropzone for this limited functionality?
You can accomplish this by modifying the stylesheet. For example, setting
.dz-details
{
display:none;
}
will remove the box which shows what was uploaded. By modifying more styles, you should be able to remove the other elements that normally appear.
You can do that on init:
const dropzoneConfig = {
addedfile: file => { console.log(file); }
}
const myDropzone = new Dropzone(myDiv, dropzoneConfig)

Safari (Host App) give selected text to App Extension?

Possible to get a text selection out from safari (host app)to an app extension, or only the URL?
Yes this is possible. You can create a JavaScript file as part of your Action Extension. This is described in the documentation since you also have to add a NSExtensionJavaScriptPreprocessingFile key to your extension's Info.plist.
Inside the JavaScript file you can define a run function which allows you to define values to pass to your native extension code. Here you can get the selected text as shown in other questions and pass this through to your extension.
Here's a quick example of how this might work on the JavaScript side:
var MyExtensionJavaScriptClass = function() {};
MyExtensionJavaScriptClass.prototype = {
run: function(arguments) {
// Pass the selected text through
arguments.completionFunction({"text": window.getSelection().toString()});
}
};
// The JavaScript file must contain a global object named "ExtensionPreprocessingJS".
var ExtensionPreprocessingJS = new MyExtensionJavaScriptClass;

Resources