Cli-microsoft365: New command: add section to modern page

Created on 13 Mar 2018  路  23Comments  路  Source: pnp/cli-microsoft365

Add section to modern page

  • command: spo page section add -n|--pageName <pageName> -u|--webUrl <webUrl> -t|--sectionTemplate <sectionTemplate> --order [order]
  • pageName: name of the page to add the section to
  • webURL: URL of the site where the page to edit is located
  • sectionTemplate: type of section to add. Allowed values OneColumn|OneColumnFullWidth| TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight
  • order: order of the section

For more information see the Add-PnPClientSidePageSection cmdlet.

new feature work in progress

Most helpful comment

@kshsbala what do you think about reusing the regex-based code from PnPJS? It's proven to be working and it would allow us to focus on adding more commands rather than building our own implementation.

All 23 comments

Can I look into this one?

Of course! Appreciate your help! 馃憤

@kshsbala have you started working on this command already? If so, what approach are you using to manipulate the page contents: regex or a DOM manipulation library? It would be good to use a similar approach across all commands related to modern pages.

Hi @waldekmastykarz , I am going to start on this one sometime this week. Prefer to use the DOM manipulation library instead of regex. If regex is used in the other commands for the DOM manipulation, it is fine as well.

That鈥檚 my preference too. I鈥檓 currently looking into the parse5 library but open to other alternatives as long as they don鈥檛 introduce too many dependencies and are maintained.

@kshsbala in case you're interested, I've put up my progress so far with parsing modern page contents using the parse5 package. It doesn't have full parity with PnP PowerShell/Sites core just yet, but getting there slowly. See https://github.com/waldekmastykarz/parse5-playground

@kshsbala what do you think about reusing the regex-based code from PnPJS? It's proven to be working and it would allow us to focus on adding more commands rather than building our own implementation.

Hey @kshsbala, are you still working on this one?

Hi @waldekmastykarz ...I am very sorry for the late reply and delay. I haven't started it yet. But I will start tomorrow and try to complete asap.

No problem. Thanks for the heads-up 馃憤

Hey @kshsbala, are you still working on this one?

Hi @waldekmastykarz , Sorry for the delay. I didnt had a chance to look because of my daily work. Started looking today. I will try to complete asap.

Thanks for letting us know @kshsbala. Totally understood if you need to prioritize your time differently. Either way, appreciate your help.

Hey @kshsbala, did you have a chance to pick it up?

Hi @waldekmastykarz, I have started working on this.

Cool! Do you have a rough idea how much work is still left?

40% completed. Planning to continue during this weekend as well.

Hi @waldekmastykarz , I am very sorry for the delay and will try to complete asap.

Thank you 馃檪

Hi @waldekmastykarz , I might have missed this. Wondering is there a plan to share some common code between PnPJs and this project?

Currently, we're using code from PnPjs to handle parsing modern page HTML to objects. Because that's the only part that we're using from PnPjs, we grabbed the relevant pieces and its dependencies which you can find at https://github.com/pnp/office365-cli/blob/7e1dfe5d96bfd09951e859b9efa9eae1f522853a/src/o365/spo/commands/page/clientsidepages.ts

Thanks @waldekmastykarz, I have extended this for adding a section. I was thinking whether we can have a common helper so that both can use the same datatype, helper methods....which cane be used for all the commands.

Adding a section should be possible using the code from clientsidepages.ts if I'm not mistaken, so we shouldn't need an additional helper class. Totally understood if you're not using that now though.

Was this page helpful?
0 / 5 - 0 ratings