When I load index.html from IDE it works fine!
But when I start compiled application it doesn't work.
The code:
_html = new HTMLLoader();
var fileURL:String = "app:/components/posteditor/ckeditor/index.html";
_html.load( new URLRequest(fileURL) );
I tried to load this file with
var fileURL:String = File.applicationDirectory.resolvePath("components/posteditor/ckeditor/index.html").nativePath;
but with no luck.
Looks like as Adobe's bug. Can you help me and advice?
Related
Works fine on dev mode, after build get this below error when upload a new image then try to render image:
Error: Cannot find module './2019-10-16T21:50:32.958Zhotel-img.jpg'
Here is the method:
docImage(index) {
let imgPath = this.userDocs[index].document.documentPath;
imgPath = imgPath.substring(imgPath.indexOf("/") + 1);
return require(`../../uploads/${imgPath}`);
}
when upload a new image then try to render image:
Thats a reason. When you require images they are bundled by webpack at build time. So any image that isnt available at build time wont be available.
I spent the whole day but was unable to find a solution.
I installed CKEditor and KCFinder, everything works fine except for one: when I want to upload a image from the "Browse Server" window file dosen't upload and result is "Unknow error".
When I upload from simple tag "Upload" the file is uploading but is not created a thumb and when I browse the server i can't see the thums of images, only icons of pic and name.
upload:
'uploadURL' => "http://domain.com/uploads/",
'uploadDir' => "../../../uploads/",
config:
CKEDITOR.config.filebrowserBrowseUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/browse.php?opener=ckeditor&type=files';
CKEDITOR.config.filebrowserImageBrowseUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/browse.php?opener=ckeditor&type=images';
CKEDITOR.config.filebrowserFlashBrowseUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/browse.php?opener=ckeditor&type=flash';
CKEDITOR.config.filebrowserUploadUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/upload.php?opener=ckeditor&type=files';
CKEDITOR.config.filebrowserImageUploadUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/upload.php?opener=ckeditor&type=images';
CKEDITOR.config.filebrowserFlashUploadUrl = '<?=$GLOBALS['_st_']['urlTree']?>libraries/kcfinder/upload.php?opener=ckeditor&type=flash';
when: $GLOBALS['_st_']['urlTree'] is dinamic something like '../' in one or more steps
I am using dojo i18n:
dojo.requireLocalization("scripts", "scprop");
var nls = dojo.i18n.getLocalization("scripts", "scprop");
to get text from nls.keyname and it is working fine.
When resource bundle changed (adding/removing keys), new bundle is not loading - still loading old bundle from cache. How to reload the new bundle. Please suggest.
I modified the dojo source code to fix this. This was done on the 1.8.x codebase. Not sure what the 1.9.x codebase looks like.
dojo/i18n.js ~line 444
// MODIFIED: append a query parameter to handle caching of
// modules/resource bundles by product version
var modUrl = url + '?dojo.cache=' +
encodeURIComponent(dojo.config.loadURIVersion || dojo.version.revision);
// ****************************************************************************
xhr.get({
url:modUrl, // MODIFIED
sync:true,
load:load,
error:function(){
results.push(cache[url] = {});
}
});
I have few JS files which i am trying to Bundle using MVC4, the code is as follows:-
public static void RegisterBundles(BundleCollection bundles)
{
//Global App Items go here.
bundles.Add(new ScriptBundle("~/Scripts/modernizr")
.Include("~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/lib")
.Include(
"~/Scripts/jquery.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*",
"~/Scripts/jquery-ui*",
"~/Scripts/jquery.tablesorter.js"));
bundles.Add(new StyleBundle("~/content/bootstrap")
.Include("~/Content/bootstrap.css"));
var lessBundle = new Bundle("~/content/myApp").Include(
"~/Content/jqueryMultiSelect.less",
"~/Content/scrollbars.css");
lessBundle.Transforms.Add(new LessTransform());
lessBundle.Transforms.Add(new CssMinify());
bundles.Add(lessBundle);
BundleTable.EnableOptimizations = true;
}
Now, when i see my console in Firefox, I can see my Response as Expected. But when same i do it in Chrome, the bundled file is broken.
Broken may be a non-technical term, What i mean by broken is :-
The file is incomplete....
Please let me know, if i need to provide more detail.
Its actually the display issue.
In chrome the js file length is limited, so does not display completely.
Try to open that file in a new tab, you will see the entire content.
In Firefox, it prompts the user to open in a new tab to see the complete content.
I am unable to get images loaded on a webpage when in the LocalState directory.
Specifically, there appears to be a security issue when attempting to launch the webpage when the file path is referencing the LocalState directory.
The webpage DOES load with images when I right-click the html file and view it in the browser within Visual Studio.
I have changed the path of the src tag to: src="ms-appdata:///Local/Logo.jpeg"
It doesn't work.
Help me...
Example code
public static async Task Update(WebView webview, IStorageFile file) {
var html = await Windows.Storage.PathIO.ReadTextAsync(file.Path);
webview.NavigateToString(html);
}
The NavigateToString method doesn't work with tags that point to images in the LocalData folder. (as far as I recall anyway). In fact NavigateToString also breaks JavaScript and CSS links.
Images on Server
One solution, is to change your source to point to a network server instead of localdata. I'm not sure it that works for your app scenario though.
Images and HTML as content
The second choice is to add your html and image files as content to your app and use
WebView1.Navigate(new Uri("ms-appx-web:///assets/SampleHtmlPage.html"));
to load the HTML.
In Process HTTP Server
Here is a solution that uses a custom HTTP server in the app to handle the issues.
Loading Local HTML Content in Metro WebView (Windows 8)
Base 64 encoded image
Finally, there is another solution using Base64 encoding of your images in the LocalData folder.
internal async void MakeHtmlString()
{
StorageFile imageFile; // get image file here.
var html =
string.Format("<div><img src='data:image/png;base64,{0}'",
await GetImageBase64(imageFile));
}
internal async Task<string> GetImageBase64(StorageFile imageFile)
{
var imageStream = await imageFile.OpenAsync(FileAccessMode.Read);
var inputStream = imageStream.GetInputStreamAt(0);
var dataReader = new DataReader(inputStream);
var dataResults = await dataReader.LoadAsync((uint)imageStream.Size);
var bytes = new byte[dataResults];
dataReader.ReadBytes(bytes);
return Convert.ToBase64String(bytes);
}
This last approach works for images, but not for CSS files.