TinyMCE menu bar icons are garbage / mojibake - character-encoding

I just downloaded a fresh copy of tinymce, uploaded it and tried to use it on my UTF-8 encoded website.
The menu bar icons are either garbage because it can't find it's presentation file (font?) or the encoding of one of the 10000 files is wrong.
Anyone knowing this bug? I didn't change anything, just uploaded..
TinyMCE doesn't use my german lang file either, obviously. I placed the js file into the "langs" folder.
<script type="text/javascript">
tinyMCE.baseURL = '//example.com/de/assets/scripts/tinymce';
tinyMCE.suffix = '.min';
tinymce.init({
selector: "textarea"
});
</script>
Do I have to set any configuration for path, basepath, ... ??
My actual path to tinymce is scripts/tinymce/tinymce.min.js. The origin path provided by the shipped package was tinymce/tinymce/js/tinymce/tinymce.min.js but honestly this kind of nesting folders without any reason..
update: The paths are working, it does read files not directly linked.. (like theme.min.js) successfully.

Related

PDFMake: Can't display chinese fonts

In my PDF download, I need to have the possibility to use both english and chinese as languages for the inserted text, but while english works I cannot make chinese to work.
I followed the documentation from here, but no matter what fonts I try to use the newly added ones always display as empty boxes, more exactly something like this [][][][].
The steps I've took are the following ones:
Downloaded the SC (and TC) fonts from the google fonts page
Converted the Regular file of the font family from .otf to .ttf using online converters (multiple sites since I've thought maybe the convertor has a problem). This resulted in two aprox. 10kb files (one for TC and one for SC).
Using the script.sh from the pdfmake documentation page, I've converted the .ttf fonts to a vfs_fonts.js, which successfully created an object that contains the font name as key and a base64 string as value
Added the necessary code to my pdf exporting service after moving the vfs_fonts.js file in my assets folder
Yet the boxes are still empty. This is my service code, where pdfFonts.pdfMake.vfs references the newly created vfs file and defaultStyle of the docDefinition is set to font: "NotoCh".
pdfMake.vfs = pdfFonts.pdfMake.vfs;
pdfMake.fonts = {
NotoCh: {
normal: 'NotoSansSC-Regular.ttf',
bold: 'NotoSansTC-Regular.ttf',
italics: 'NotoSansSC-Regular.ttf',
bolditalics: 'NotoSansTC-Regular.ttf',
},
};
I used both SC and TC files because initially I thought I was using the wrong chinese characters, but it doesn't matter which ones I use, it still doesn't work, and I receive no error in the console or at compile time. What am I missing in here?
EDIT: These are the characters I am trying to display, as an example: 简体中文体中文
It looks like this is a bug related to Noto fonts present in the latest pdfkit version 0.11.0, which was seemingly fixed in pdfkit-next. Link to the bug
Not sure if you've solve your problem yet. I had the same issue before and I finally solved the problem after trying out many solutions posted online: So what you have been doing is correct and will work, as long as you include your custom font as the new default font style in your document definition. I have included my test html code below for your reference.
Note: The custom font file doesn't have to be in .ttf format. I'm using Noto Sans SC from Google Fonts and the .otf files work just fine. (I'm using pdfmake v0.1.68).
<!DOCTYPE html>
<html>
<head>
<title>PDFMake with Chinese Font</title>
<meta charset='utf-8'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="vfs_fonts.js"></script>
</head>
<body>
<div id="test">尝试加入简体中文</div>
<script>
pdfMake.fonts = {
NotoSansSC: {
normal: 'NotoSansSC-Regular.otf',
bold: 'NotoSansSC-Bold.otf',
}
};
var docDefinition = {
content: document.getElementById('test').innerHTML,
defaultStyle: {
font: 'NotoSansSC'
}
}
pdfMake.createPdf(docDefinition).download();
</script>
</body>
</html>

Load html file from my firefox extension's directory

TLDR; In a Javascript file for my Firefox extension, how can I load the contents of other files from inside my extension (such as an HTML view & CSS stylesheet) for use on the current web-page?
I'm working on my first Firefox extension, for personal use.
So I setup my manifest.json to load /script/panel.js when any page of the site loads.
In panel.js, I would like to do something like:
const html = MyExtension.getFileContent('/view/panel.html');
const node = document.createElement('div');
node.innerText = html;
document.body.appendChild(node);
But I can't find anything like MyExtension.getFileContent(). All I've been able to find is how to add sidebar (through manifest?) & browser action for the toolbar at the top of the browser & other non-programmatic ways of exposing files that are inside my extension.
Then in /view/panel.html, Ideally, I'd like to also reference /style/panel.css which is also found inside my extension's root directory, such as with a <link tag.
Did you set web_accessible_resources in your manifest.json? It is required to make resources in your extension readable from webpages.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources

correctly reference jquery mobile locally

user3568918 has responded to the following question:
jQuery Mobile not working with Internet Explorer?
Dont forget to keep the right binding Order:
jquery mobile css
jquery script
jquery mobile script
My question is :
When I go to download page of jquery mobile
https:/ /jquerymobile.com/download/
I see two viable options for me :
Download the javascript, css and images :
https:/ /jquerymobile.com/resources/download/jquery.mobile-1.4.5.zip
Download the minified javascript :
http:/ /code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js
If I choose 1, two additional subfolders "demos" and "images" are created, which have their own sub-folders.
Do I have to reference all these subfolders in my html ?
If I choose 2, which is to download the minified javascript only, how do I reference the images that I want to use for icons?
Thanks a lot in advance.
Example: assuming your index.html is the root, you should reference:
<link rel="stylesheet" href="css/jquery.mobile.1.4.5.min.css" />
<script src="js/jquery-1.11.2.min.js"></script>
<script src="js/jquery.mobile-1.4.5.min.js"></script>
Then, the directory structure on your server shall be like this:
\index.html
-- All jQuery files shall be in \js subfolder and \css subfolder
\js\
----jquery-1.11.2.min.js
----jquery-1.11.2.min.map
----jquery.mobile-1.4.5.min.js
----jquery.mobile-1.4.5.min.map
(...other stuff)
\css\
-----jquery.mobile-1.4.5.min.css
-----jquery.mobile.external-png-1.4.5.min.css
-----jquery.mobile.icons-1.4.5.min.css
-----jquery.mobile.inline-png-1.4.5.min.css
-----jquery.mobile.inline-svg-1.4.5.min.css
(...other stuff)
\css\images\
------------ajax-loader.gif
------------icons-18-black.png
------------icons-18-white.png
(...other stuff)
\css\images\icons-png\
----------------------action-black.png
----------------------action-white.png
(...a lot of other stuff)
\css\images\icons-svg\
----------------------action-black.svg
----------------------action-white.svg
(...a lot of other stuff)
EDIT:
subfolders demos and images inside the zip file are ready for you if you need to have the JQM demos also available on your local site, there is also a custom css file special for the demos.
I think this will also clarify some aspect of your question: https://css-tricks.com/data-uris/

Porting static html/javascript site to iPad using trigger.io

Im currently in the process of porting a completely static site using trigger io to convert it to an app. The site comprises of lots of folders in folders with index.html files in them to make the urls nice. The site uses absolute urls to include stylesheets, javascripts, on a tags, and images in every page.
I would like to set a root directory for trigger.io, but I cannot find any way of doing this. Is this even possible?
Cheers,
Rich
Edit:
Example:
<script src="/json.js" type="text/javascript"></script>
<img alt="Bar_hat" class="bar_hat" src="/assets/bar_hat-09efbabebef04dd368425a6b71badfa7.jpg" />
The script tag is in all of the files.
The img tag is used in 90% of the files. These are obviously not being found from within the app.
Copy your "assests" directory to the "src" directory and use without a "slash" before assets -
<img alt="Bar_hat" class="bar_hat" src="assets/bar_hat-09efbabebef04dd368425a6b71badfa7.jpg" />
Also, if you want to access via javascript you must use this pattern:
forge.file.getUrl("assets/bar_hat-09efbabebef04dd368425a6b71badfa7.jpg",
function(file) {
// If using zepto or jquery
$("#whateverImage").attr("src", file);
},
function(err) {
// error
}
);
Edit: getUrl vs getLocal

ScriptManager in an MVC project trying to load MicrosoftAjax js files from a strange path

I have a WebForms app that I'm converting to MVC, but for now running legacy stuff side-by-side.
For some reason, the ScriptManager left to it's own devices tries to load the following files from a very strange (and non-existent) location:
<script src="Scripts/WebForms/MsAjax/MicrosoftAjax.js" type="text/javascript"></script>
...
<script src="Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js" type="text/javascript"></script>
I can't find the setting of that location, and googling "Scripts/WebForms/MsAjax" brings back nothing.
Changing the (obsolete) ScriptPath property on the ScriptManager does nothing to help with these two scripts.
Trying to override the Path location like the following also does not work (it just tries to load both scripts)
Scripts.Add(new ScriptReference { Name = "MicrosoftAjax.js", Path = ContextUtil.MapApplicationPath("~/My/Script/Location/MicrosoftAjax.4.0.js") });
Scripts.Add(new ScriptReference { Name = "MicrosoftAjaxWebForms.js", Path = ContextUtil.MapApplicationPath("~/Shared/Scripts/Legacy/MicrosoftAjax/MicrosoftAjaxWebForms.4.0.js") });
What I can't understand is
Why is it not loading the scripts by default from a Embedded Resource?
Where is this strange path coming from?
Why won't it accept my overridden script paths?
Can anyone help?

Resources