-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular Integration (into an already existing application) #149
Comments
Hi @ejthan, short answers would be to look at pageHost.ts file which you can find in paperbits-core module. We didn't really design it to be used the way you're asking about, but with some refactoring it can be achieved fairly cheap . If you decide to go with Paperbits, we can assess it properly and work together to solve it. |
Yes, this is what I'm interested in. Paperbits functionality is only.a small bit of my app that people who use our app will build small pages with. The rest of the app will have nothing to do with Paperbits only a small section. @ejthan you want to work together? They have some contribution guidelines @azaslonov thanks for your response. Are you implying you are working on it? |
@pandabuilt yes i would like to work together, i'm a product manager and i'm new to coding... so i'm not sure if i can be very helpful. We have an angular developer at the company i work for, i will check if he is able to help us but he probably won't be able to do so until August. |
@pandabuilt we're working on integration stories: one of them is having widgets in a number of UI frameworks (including Angular), and the other one I hear about is partial integration (similar to what you guys described above), and we are assessing it now. I also have a few questions to better understand the scope:
|
JSON will always work. I'd rather have you handle the publishing than me.
I would say yes, I'd like users to style.
The lifecycle is to add "Builder" module and create / edit screens and publish them. When they are published (not draft status) they are live in the users plugin. I am looking into storing versions and also thinking about storing default templates they can start from. |
Our idea for implementing paperbits in our app would look like this: paperbits is inserted as an angular component. The logic to create new pages is already available in our app, so we do not need it again. Saving styles, layouts and adding new widgets would then work in the same way as the already implemented logic of paperbits. |
So like something like : That would work for me. |
Ok, that makes sense. I believe that you can do your PoC even now: |
Okay, @azaslonov got it. I will create a component. As far as dependencies go for the component? Is it correct that I will need the following: |
@azaslonov Is that correct to add to my existing angular project? |
Hi @pandabuilt, sorry, I missed your previous message somehow. So, answering that one first: Not sure what exactly you mean. I guess there are two ways of integration:
|
@azaslonov I'm doing 1 (discussed here) Paperbits is only a part of my project. |
So yes, those libs I mentioned are the required minimum for paperbits to run. And startup.ts in paperbits-demo is a good bootstrapping example that you can do inside your Angular component. Please let me know if you need help with that. |
Hi, I'm interested by this too, i've already discussed with @azaslonov the procedure to follow to achieve this. But I'm stuck with many compilation errors in the module : @pandabuilt have you seen this type of errors ? I don't understand how Angular can compile a Knockout module... 🤔 Thanks. |
Hi @tmmschmit, I assume you created a new project and trying to move some parts there. So, this one happens because of missing module.d.ts (please see ./src/module.d.ts). Another thing that might come up is webpack's html-loader (see webpack.designer.js). |
Btw, we published basic information about that integration here https://paperbits.io/wiki/ui-frameworks#A1Jea. We'll continue to work on it, so please check back there from time to time. |
Thanks again @azaslonov, the For the two first one, i think you override these functions in
🤔 |
Hi @azaslonov ! I am also trying to insert paperbits as separate component to my angular app. Could you please advise what should I do? Because description in documentation is not very clear for me. Should I build designer app and include js files angular.json of my application? |
@starostin Hi. I hope @azaslonov doesn't mind me chiming in. He's helped me so much Go check out @paperbits/examples and they have a ui example for angular in that repo. Step 1 - add paperbits packages to package.json - currently I have:
You're going to need Jeb's @angular-builders/custom-webpack package - Just checkout that example repo for all the packages. Just run a diff against your angular app. Cause you have an entire angular app. You'll want to proceed with caution. Your building will change by following his examples Step 2. Diff check their angular.json compared to yours.... change what you need to to ensure the new builder is used.... Step 3. Make sure your tsconfig.json / tsconfig.app.json are similar Step 4. Copy over webpack.config.js into your root folder Step 5. Add any missing polyfills Step 6. Add import "./paperbits/startup.design"; to your main.ts Step 7. Build your component with Make sure that you import this into the module. |
ENSURE this is in your tsconfig.app.json - "emitDecoratorMetadata": false |
Thanks a lot guys. Now it works fine. And I am trying to get data from staticObjectStorage in my main angular app. So I have created service, registered it in demo.design.module like this |
I think that's because Angular has it's own DI container (this, btw, is something for us to look in the future). What you can do is to register same instance of the service, if possible:
Angular Paperbits |
Thanks @azaslonov, I am using the same approach. Also I wanted to ask, is it possible to reload design app component with different json?. So I have angular app which is sending website json to the server and save in to db (it is already done), and also I need the ability to get json from the server and show website from it. I see in staticObjectStorage |
Ok, this one is simple, there is a default registration of ILocalCache: You can either replace it (in startup.design.ts) with, i.e. instance of |
Thanks @azaslonov , each day I am learning something new. So I have changed |
I have found solution. So I don't rerender angular component, I am using
or also I can use
|
After that I have tried to update layout (made top menu vertical), and tried to refresh website (like I described in previous post), but it did not work. It there some other way to update layout? |
You mean you update layout through designer? Or you push data? |
Update layout through designer, and after that tried to load other website from server, but it does not work. Without changing layout it works fine |
Sorry, just to understand, you changed a layout of one website and wanted to apply it to another website? Could you please describe the scenario a bit more? |
No, I changed the layout of one website, and just want to load different website from the server, without applying any changes which I made (so they will be lost) |
I see, I think could reproduce this. You changed the layout, and without exiting layout editing, tried to load another website data, right? |
Actually, seems I exited layout editing. I pressed Esc on the keyboard and it closed Editing mode |
But interesting thing, that when I start preview mode, go to different page, and go back, I see that website changed |
Ok, we never thought about this scenario, I guess we'll bring some kind of "reset" operation. For now, I think what you can do is to invoke
|
It does not work for me. And also I debugged a bit, and see that |
Not sure yet. Give me 2-3 days, I'll investigate and make adjustments. |
Hi this looks very promising.
At the moment i do not understand how this could be integrated into an already existing Angular application.
For example, i would like to use this in an already existing angular ecommerce application.
I don't need the full implementation, i would like to use the editor only on specific pages.
Is there any chance you could explain, how a possible implementation into an already existing app would look like?
The text was updated successfully, but these errors were encountered: