KeystoneJS S3 Image Upload from TinyMCE WYSIWYG - amazon-s3

I can't seem to find any documentation on converting the KeystoneJS TinyMCE wysiwyg to accept image files to upload to S3. I have added the following to my init (some as a failsafe/testing):
'wysiwyg additional plugins': 'uploadimage',
'wysiwyg images': true,
'wysiwyg s3 images': true,
Upon investigation, it seems that Keystone recognizes 'wysiwyg s3 images' but is trying to activate the uploadimage plugin that no longer exists in node_modules/admin/public/js/lib/tinymce/plugins.
I am running Node#10.15.0, NPM#6.7.0, and KeystoneJS#4.0.0-beta.5

Updating keystone from version 4.0.0-beta.5 to version 4.0.0 helped me to avoid the tinymce plugin problem.

Related

how to open PDF URL into the app without downloading in ionic 5

i am already try with this plugin but no luck
how to achieve like this
https://ionicframework.com/docs/native/file-opener
https://ionicframework.com/docs/native/document-viewer
Here is Ionic 5 Repo with PDF View without download
Ionic 5 With ng2-PDF-Viewer
How to run :
Clone Project
npm i
npm start
For More set PDF Options
ng2-pdf-viewer
You can also directly open the PDF by using window.open
window.open(this.URL + name +'.pdf');
It will work.
You can use PDF.js component:
https://mozilla.github.io/pdf.js/
Here is a video of PDF.js component wrapped as Appery.io plugin
https://www.youtube.com/watch?v=JeEJl7K-2H0

How can I reduce the webpack bundle size for a Vue.js / Nuxt.js project incorporating AWS SDK?

Summary:
I have created projects, with Vue.js and Nuxt.js, where I have installed aws-amplify (which automatically installs aws-sdk) in order that I can implement authentication with AWS Cognito.
In both cases, this works very nicely, but the problems come when I build production versions.
In both cases, I end up with massive bundle sizes which (thanks to webpack-bundle-analyzer) I can immediately see are caused by the aws-sdk which appears to contain code to implement every AWS service, under the sun, despite the fact that I am only importing AWS Cognito's: "Auth" (import { Auth } from 'aws-amplify')
I have tried creating a custom AWS SDK for JavaScript, which only includes the service: AWS.CognitoIdentity, but despite incorporating that (presumably incorrectly), I still end up with the same bundle size (and aws-sdk files) when I build the projects.
As I say, this is happening in both Nuxt and Vue project, but in order to simplify this, I for now just want to find the solution to a very basic sample project created with Vue.
I think I must be doing something dumb, but I can't work out what that is.
Any help would be greatly appreciated! :-)
Steps to reproduce:
Create a basic Vue.js project with defaults. Run: vue create vue-aws-sdk-inv
[Note: Steps 2 - 4, are not crucial to reproduce issue, but install webpack-bundle-analyzer which provides useful extra info.]
In the new project, install webpack-bundle-analyzer. Run: npm install --save-dev webpack-bundle-analyzer
Create root file: vue.config.js
Add the following code to vue.config.js:
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = {
configureWebpack: {
plugins: [new BundleAnalyzerPlugin()]
}
};
As a benchmark, build the project. Run: npm run build
At this stage, the project will build (with no console warnings) and webpack-bundle-analyzer will launch (in the browser) showing the file: chunk-vendors..js, at the top of the tree, containing a bunch of other .js files, all of acceptable size.
Install AWS Amplify (and by default aws-sdk). Run: npm i aws-amplify
Open src/components/HelloWorld.vue and add the following under the tag: import { Auth } from "aws-amplify";
Build the project. Run: npm run build
At this stage, the project will build WITH console warnings regarding the following files being too large:
File Size Gzipped
dist/js/chunk-vendors.013ac3f0.js 3055.78 KiB 550.49 KiB
dist/js/app.fa2a21c4.js 4.67 KiB 1.67 KiB
dist/css/app.53019c4c.css 0.33 KiB 0.23 KiB
If installed, webpack-bundle-analyzer should launch (in the browser) showing an inflated: chunk-vendors..js, due to a hefty: aws-sdk.
aws-sdk will include api: .json files and lib: .js files for every AWS service I can think of!
The attempt to rectify:
Navigate to: https://sdk.amazonaws.com/builder/js/
Clear all services.
Select just: AWS.CognitoIdentity
Download "Minified" aws-sdk-.js
Download "Default" aws-sdk-.min.js
[Note: the following are the steps I am guessing I'm getting wrong?...]
In the project, search the node_modules directory for aws-sdk.js and aws-sdk.min.js.
They were found in /node_modules/aws-sdk/dist
Replace both files with the downloaded files (renaming to aws-sdk.js and aws-sdk.min.js respectively.)
Build the project. Run: npm run build
Project will build with same console warnings and same massive aws-sdk, as before, containing all the same .js and .json files for a bunch of services that are not actually imported in the application.
Final pieces of analysis:
Remove aws-sdk.js and aws-sdk.min.js from project's: /node_modules/aws-sdk/dist
Build the project. Run: npm run build
Project is built without even referencing these files.
Rename /node_modules/aws-sdk to /node_modules/TEMP_aws-sdk and attempt to build the project.
Build fails, and this proves (I think) that I was at least trying to add the custom versions, of aws-sdk.js and aws-sdk.min.js, somewhere in the correct directory!
Source Code:
vue.config.js:
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = {
configureWebpack: {
plugins: [new BundleAnalyzerPlugin()]
}
};
src/components/HelloWorld.vue:
import { Auth } from "aws-amplify";
As said before, any help would be greatly appreciated! :-)
It looks like import { Auth } from "aws-amplify"; doesn't currently allow for tree shaking according to this issue.
Reading through several related issues, it appears that:
import Auth from '#aws-amplify/auth';
is the best you can currently do. I suspect that over time, the AWS team will figure out a way to better separate the internals.
For readers looking for a way to reduce bundle sizes for the aws-sdk package, see this section of the docs.
In my case:
import S3 from 'aws-sdk/clients/s3';
import AWS from 'aws-sdk/global';
cut the bundle size down by quite a lot. That gets it down to ~57k gz to use S3.
Also, for anyone using nuxt you can just run nuxt build -a to get the build analyzer.

Drag and drop file electron/vue.js

I am trying to make an app with electron and vue.js, in this one I want to make a DropZone for file and just get the path of this file. My problem is that electron is opening my file like a file viewer. How can I disable it with vue.js ?
The will-navigate event is designed to catch/parse dropped files in electron. So it is not a vue.js specific issue.
This snippet will prevent the render process from loading the image as content.
mainWindow.webContents.on('will-navigate', (event) => event.preventDefault());
Reference: https://github.com/electron/electron/issues/5919
API Docs: https://github.com/electron/electron/blob/master/docs/api/web-contents.md#event-will-navigate

How to change default icons in mule while developing custom connector?

As I am working with the latest devKit (version 3.9.0). #Icons option is not available in the same. So is there any other way to change default icons in mule while developing custom connector?
Created two folders inside the icons folder i.e theme.light and theme.classic and each should have as per following:
theme.light:
connectorname-connector-large.png (pixel: 26x26)
connectorname-connector-small.png (pixel: 16x16)
theme.classic:
connectorname-connector-large.png (pixel: 48x32)
connectorname-connector-small.png (pixel: 24x16)
It worked for me.
Check in the package explorer in studio for a folder call "icons". Inside this folder you will find 2 images.
DevKit will use icons with the following syntax:
Small: {connectorName}-connector-24x16.png
Large: {connectorName}-connector-48x32.png
NOTE: check the size of your images
After this you can re install the connector.

BigCommerce Stencil - TypeError: window.stencilBootstrap is not a function

Since around 10:30am EST today, I have been unable to apply stencil custom themes successfully. Any theme bundled before 10:30am EST today works fine when applied to a storefront. The themes work fine locally, and there are no errors when bundling, but once the theme is applied, the page loads HTML without images or any styling applied. The error in the console reads "TypeError: window.stencilBootstrap is not a function".
I have verified the issue on multiple accounts, and even occurs when trying to bundle and apply a fresh Cornerstone clone.
There are no reported issues on status.bigcommerce.com
Is anyone else having similar issues today?
Do I need to update my CLI?
Thanks
At the time of giving command stencil bundle, it will clear 'assets/dist' files. So that throws error theme-bundle.main.js file missing and window-stencilBootstrap is not a function.To avoid Clearing 'assets/dist' follow below steps.
Comment this below line in webpack.conf.js which is in root folder
/new CleanWebpackPlugin(['assets/dist'], {
verbose: false,
watch: false,
}),/
After this, run stencil bundle 'asset/dist' folder will not clear by doing so. Check u have 'assets/dist' folder then upload. After uploading your theme, front end will works fine.
This is a bug at stencil-cli.
There is an open issue for it: https://github.com/bigcommerce/stencil-cli/issues/379
I have just submitted a pull request with a possible fix: https://github.com/bigcommerce/stencil-cli/pull/409
In the issue, I suggest a workaround which can be done in the theme, without having to modify stencil-cli.
At stencil.conf.js, remove these two lines from the top of the file:
var webpack = require('webpack');
var webpackConfig = require('./webpack.conf.js');
Copy them as the initial lines of development and production functions, where these variables are actually used.
This change usually fixes the issue.