Appcelerator CKeditor android WebView - webview

I'm trying to use the ckeditor in my app via WebView on android.
On iOS the ckeditor appear prefectly, but on android I have this error:
I/TiWebChromeClient.console: (main) [49519,49519] Uncaught TypeError: Cannot set property 'dir' of undefined (4466:file:///android_asset/Resources/lib/ckeditor/ckeditor.js)
In the ckeditor documentation appear this but it doesn't work anyway.
I'm thinking if it can be an error of Titanium, because on iOS all works perfectly.
This is my html code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
var CKEDITOR_BASEPATH = '/lib/ckeditor/';
window.CKEDITOR_BASEPATH='/lib/ckeditor/';
</script>
<script src="../ckeditor.js"></script>
<script src="js/sample.js"></script>
<style>
body{
margin: 0px;
}
</style>
</head>
<body id="main">
<div class="adjoined-bottom">
<div class="grid-container">
<div class="grid-width-100">
<div id="editor">
<h1>Hello world!</h1>
<p>I'm an instance of CKEditor.</p>
</div>
</div>
</div>
</div>
<script>
initSample();
</script>
</body>
</html>

Titanium supports CKEDITOR.
ckeditor.js calls config.js, styles.js and so on. In the html file, provide path to those missing dependency files.
1] Include the dependency files for ckeditor
<script src="lib/javascript/ckeditor/ckeditor.js"></script>
<script src="lib/javascript/ckeditor/config.js"></script>
<script src="lib/javascript/ckeditor/styles.js"></script>
<script src="lib/javascript/ckeditor/lang/en-gb.js"></script>
<script src="lib/javascript/ckeditor/plugins/panelbutton/plugin.js"></script>
<script src="lib/javascript/ckeditor/plugins/colorbutton/plugin.js"></script>
<script src="lib/javascript/ckeditor/plugins/colorbutton/lang/en.js"></script>
<script src="lib/javascript/ckeditor/plugins/colorbutton/lang/en-gb.js"></script>
2] For mobile application ckeditor isCompatible has to be set.
<script type="text/javascript">
CKEDITOR.env.isCompatible = true;
</script>
CKEDITOR.basepath setting is not required for the mobile application.

Related

Uncaught TypeError: Cannot read property 'v0' of null in dart

I feel kinda silly asking this question but I have tried everything I know and even consulted the api docs all to no avail.
My question is how to fix:
Uncaught TypeError: Cannot read property 'v0' of null
What I am doing is compiling a dart based chrome app with dart2js using dart-sdk version 1.10 I have also tried dart-sdk version 1.9 with the same result.
All of my code is located at:
https://github.com/dragonloverlord/Pages
I am building my project in pycharm community edition 4.5 with the dart plugin if that matters.
I have tried using 'build mode=debug' but no different message was given I had the source maps set up as well but nothing changed.
The os that I am building on is linux ubuntu 15.04
I have found the solution to the issue and it's actually very simple!
All you have to do is move the dart scripts to the body of the document like so:
<!DOCTYPE html>
<html id="html">
<head>
<meta charset="utf-8">
<title>Pages</title>
<link rel="stylesheet" type="text/css" href="./css/index.css">
</head>
<body id="body">
<div id="menubar">
<button class="float-left" id="add-page" type="button">Add Page</button>
</div>
<div id="main-container">
</div>
<script src="packages/chrome/bootstrap.js" type="text/javascript" defer></script>
<script src="main.dart" type="application/dart"></script>
</body>
</html>
Compared to having them in the head of the document like so:
<!DOCTYPE html>
<html id="html">
<head>
<meta charset="utf-8">
<title>Pages</title>
<link rel="stylesheet" type="text/css" href="./css/index.css">
<script src="packages/chrome/bootstrap.js" type="text/javascript" defer></script>
<script src="main.dart" type="application/dart"></script>
</head>
<body id="body">
<div id="menubar">
<button class="float-left" id="add-page" type="button">Add Page</button>
</div>
<div id="main-container">
</div>
</body>
</html>
A very simple fix that is often forgotten!
Also adding defer to the dart script will fix the issue like so:
<!DOCTYPE html>
<html id="html">
<head>
<meta charset="utf-8">
<title>Pages</title>
<link rel="stylesheet" type="text/css" href="./css/index.css">
<script src="packages/chrome/bootstrap.js" type="text/javascript" defer></script>
<script src="main.dart" type="application/dart" defer></script>
</head>
<body id="body">
<div id="menubar">
<button class="float-left" id="add-page" type="button">Add Page</button>
</div>
<div id="main-container">
</div>
</body>
</html>

Why can´t I get this very easy tooltip code work..?

Yes...now I´m bringing the most simple script in the world...and though I can´t get it work!
MUST the word, tooltip be included in the .js file to work ? It doesn´t exist in my .js
May I include more .js files in my script, or should I just take the newest release ?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#outdoor img[title]").tooltip();
});
</script>
<style type="text/css">
#tooltip
{
display:none;
font-size:12px;
height:70px;
width:160px;
padding:20px;
color:Gray;
}
#outdoor #nature
{
margin-top:200px;
}
</style>
<title></title>
</head>
<body>
<div id="tooltip"></div>
<div id="outdoor">
<img src="../img/forest.jpg" id="nature" alt="ghghg" title="I love the nature"/>
</div>
</body>
</html>
You haven't written a tooltip() function in Javascript, that's why it doesn't work.
You need to include in your HTML file, these lines:
<script type="text/javascript" src="http://jquery.bassistance.de/tooltip/jquery.tooltip.js"></script>
<link rel="stylesheet" href="http://jquery.bassistance.de/tooltip/jquery.tooltip.css" />

Styles not applied when app starts

I have a strange problem with an app developed using phonegap and jquery mobile:
when the app starts, styles are not applied but if I browse within the app and then go back to the index, I can see styles well applied.
What should I change?
Here is my index.html code:
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=10.0">
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
var intervalloRefresh;
var intervalloRisultati;
var iter=0;
// Wait for Cordova to connect with the device
//
document.addEventListener("deviceready",onDeviceReady,false);
// Cordova is ready to be used!
//
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
}
</script>
<script type="text/javascript" src="jquery/jquery-1.5.2.min.js"></script>
<!-- <script type="text/javascript" src="main.js"></script> -->
<script type="text/javascript" src="jquery/jquery.mobile-1.1.1.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<style>
#pulsantiera{width:25%;height:100%;float:left;}
</style>
</head>
<body>
<div data-role="page">
<div data-role="content">
<div id="pulsantiera" data-role="controlgroup" data-type="vertical">
<!-- Allineamento -->
Allinea
Percorsi
Programma
Info
Foto
Chat
Y
A
N
</div>
<div style="width:74%;height:100%;margin-left:26%" >
<h1 id="title">PATH</h1>
<div id="content">
<img src="images/IT_MAPPA.jpg">
</div>
<div id="vote" stle="display:none"></div>
</div>
</div>
</div>
</body>
</html>
Have you tried switching the position of your CSS and JS files?
If parsed from top to bottom:
1) jquery is initialized
2) jquery mobile is initialized
3) then the CSS is loaded
So the CSS needed for the JQM widgets is not there when JQM kicks into gear.
Try switching to:
1) all CSS
2) jquery
3) jquery mobile
Also check the JQM page template. The CSS always goes first.

Jquery mobile and wrapper

I've developed a phoneGap app for iOS and it works.
Now I'm trying to switch it on JqueryMobile in order to improve graphic.
This is the code of index.html page.
What must I change to make it works with JQueryMobile?
I tried to use css styles and library of jQueryMobile and modify header and footer but I can't understand where I must place <div data-role="page"> in my file.
I haven't also understood if I must leave id=header and class=header or not.
<head>
<title>x Directory</title>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="js/cordova-1.7.0.js"></script>
<script type="text/javascript" charset="utf-8" src="ChildBrowser.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-WebInspector.js"></script>
</head>
<body>
<div id="header" class="header">
Home
<img src="img/mob.png" class="logo" id="logo"/>
<h1>xAsk</h1>
</div>
<div id="wrapper">
<ul id="xList" class="icon-list"></ul>
</div>
<div id="wrapper_hidden">
<div>
<div id="employeeDetails">
<img id="xPic"/>
<h3 id="xName"></h3>
<p id="xEmail"></p>
<p id="city"></p>
</div>
<ul id="actionList"></ul>
</div>
</div>
<div id="footer" class="footer">
<ul id="azioni">
</ul>
</div>
<script src="js/jquery.js"></script>
<script src="js/iscroll.js"></script>
<script src="js/xlist.js"></script>
</body>
Start with one of the examples first. Jquery mobile changes the way your application is structured. You're not including jquery-mobile.js, so your example does not work.
The should be around your header, data and footer, but in order to have multiple (inline) pages, you need more of them.

jquery datepicker shows up without theme

<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css"/>
<script>
$(document).ready(function() {
$("#TextBox1").datepicker();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
Should I be linking any other css files? Or is it a problem with Google CDN?
you are using <script> for css instead of <link>
EDIT:
and rel="stylesheet" is missing
Still cant figure out how to do it with external CSS. A faster solution was to keep the CSS files local.

Resources