Skip to content
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

New command: add text to modern page #365

Closed
waldekmastykarz opened this issue Mar 13, 2018 · 23 comments
Closed

New command: add text to modern page #365

waldekmastykarz opened this issue Mar 13, 2018 · 23 comments

Comments

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Mar 13, 2018

Add text to modern page

  • command: spo page text add -n|--pageName <pageName> -u|--webUrl <webUrl> -t|--text <text> --section [section] --column [column] --order [order]
  • pageName: name of the page to add the section to
  • webURL: URL of the site where the page to edit is located
  • text: text to add to the page
  • section: number of section to which the text should be added (1 or higher)
  • column: number of column in which the text should be added (1 or higher)
  • order: order of the section

For more information see the Add-PnPClientSideText cmdlet.

@ypcode
Copy link
Contributor

ypcode commented Jun 25, 2018

@waldekmastykarz I can take this one if you're happy with #366

@waldekmastykarz
Copy link
Member Author

Please do! 👏

@ypcode
Copy link
Contributor

ypcode commented Jun 26, 2018

Ok, I will pretty soon.

Quick question, since most of the code would be copy of the clientsidewebpart add command, do you prefer to refactor, or to copy/paste the code ?

if refactoring, should I go for an base class or a helper class to consume ?

@waldekmastykarz
Copy link
Member Author

Let's go with a helper. That gives us more flexibility in case we need to refactor in the future

@ypcode
Copy link
Contributor

ypcode commented Jul 4, 2018

Hi @waldekmastykarz , just to keep you up to date, I am a bit delayed on that, but I started refactoring and had to refactor the specs as well. But still on going, don't worry :)

By the way, what do you think of closing the #366 PR and process the upcoming one with the WebPart and the Text commands ?

@waldekmastykarz
Copy link
Member Author

Thanks for the update @ypcode. I'm processing open PRs typically once a week. I try not to add new commands just before a release to avoid last-minute issues, which is why I haven't processed your PR yet. Still, it's on my to-do list for the coming weekend, and if all is well, will be included in the next beta.

@ypcode
Copy link
Contributor

ypcode commented Jul 4, 2018

Don't worry, that is totally fine, no rush here :)
I was just thinking, since all the common code will be moved in a helper class. I think that might be not worthy to spend time on that one, since there will big "changes" in this one here...

@waldekmastykarz
Copy link
Member Author

You can include the same file in the next PR and when I'll merge them, it will become one and the same.

@ypcode
Copy link
Contributor

ypcode commented Aug 20, 2018

Hi,

Just a quick update on this, I implemented the new command, but I found a quite significant bug when playing with sections (the layout of the page is being screwed up) at this is probably also present in the clientsidewebpart command.
I found out there was some issues in the code copied from pnp js at the time.
All are now fixed so I recopied the latest implementation.

However, some tests are now failing in other commands, I have to figure out all these before submitting the PR :)
Hopefully this will be done this week

Regards,
Yannick

@waldekmastykarz
Copy link
Member Author

Thanks for the update @ypcode! Have you checked if the bug is fixed in PnPjs from which we borrowed the code? If so, it would be great if you let the guys know and share your findings.

@ypcode
Copy link
Contributor

ypcode commented Aug 20, 2018

Yes, it is fixed on their side since I actually ported back the latest implementation of the clientsidepage file with some changes to remove the pnpjs dependencies, that is what actually causes some tests to fail...
I am digging into it to find out what exactly has changed.

BTW, I also added one method to properly handle the --order argument. I realized the specs say it is the order of the section, but actually it should be "the order of the control", I will make the changes accordingly

@waldekmastykarz
Copy link
Member Author

Cool! Glad that we have tests that verify how things work ☺️

@ypcode
Copy link
Contributor

ypcode commented Dec 10, 2018

Hey @waldekmastykarz, actually, As I recopied manually all my changes to a new branch from the updated dev trunk, I forgot to recopy the updated PnPJS class that has fix many issues.
What I don't understand is how it can work on your side Oo ??

Will make this work ASAP

@waldekmastykarz
Copy link
Member Author

Perhaps we're looking at different scenarios. If the issue is with PnPjs, rather than just fixing it in our copy, it would be better, to log it in the PnPjs repo. Patrick and the crew spent significantly more time dealing with modern page HTML than us so they can be a better judge of whether it's really an issue and how it should be fixed, or we're just using it in an odd way.

@ypcode
Copy link
Contributor

ypcode commented Dec 10, 2018

Will definitely talk with them once I resynced with the latest version of the clientsidepage class.
Maybe everything would be just fine after that :)

What a pity I actually lost the changes I already started to bring...

@ypcode
Copy link
Contributor

ypcode commented Dec 11, 2018

Hi @waldekmastykarz , I resynced the clientsidepage class from pnpjs.

Everything works fine except that many tests are now failing mainly because the expected HTML was erroneous (there was a single closing div tag in the html returned by the pnpJS code.

The branch is available on my own repo : https://github.com/ypcode/office365-cli/tree/dev-spo-page-text-add

It takes a lot of time to correct the failing tests even if the commands still work, and unfortunately I will lack some... As I understood you were waiting on it, do you want me to submit it as PR with the tests failing ?

I will also need later to refactor the thing with WebPart to properly handle inserting them with a specific order

@waldekmastykarz
Copy link
Member Author

I can grab the code from your fork and work on that. You will of course get the credit for your work 😊

With regards to properly handling web part order, I'd expect to be handled correctly by PnPjs. If it's not, then we should raise an issue there and sync the updated version which will help a broader audience benefit of the fix.

Once again thanks for your help and I appreciate your time 👏

@waldekmastykarz waldekmastykarz self-assigned this Dec 11, 2018
@ypcode
Copy link
Contributor

ypcode commented Dec 11, 2018

Sounds good 😃
I would definitely prefer to work much more on it and on the CLI in general but these days, it's become complicated, so much work and different projects and occupation, I just can't scale 😀

I will also make sure, if not handled in the meantime, the WebParts command works fine with order + need some refactoring also...

Thanks for this wonderful and very addictive project, you're leading and Thank YOU very much for your acknowledgement! It's always good to receive from a star like you 😄

@waldekmastykarz
Copy link
Member Author

It's not always easy to prioritize hobby side-project with everything else in life, so when we do get a contribution, we appreciate it, no matter how small it is.

@waldekmastykarz
Copy link
Member Author

FWIW: I had a look at the order option and it turns out that it never worked. Like you mentioned, it isn't there and the order option specified while adding web part is ignored. We'll be able to make a good use of your code so far! 👏

@ypcode
Copy link
Contributor

ypcode commented Dec 16, 2018 via email

@ypcode
Copy link
Contributor

ypcode commented Dec 16, 2018 via email

@waldekmastykarz
Copy link
Member Author

There is no rush for it as so far no one spotted it. I can log an issue for it and assign it to you. Thanks again for bringing it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants