Git Product home page Git Product logo

Comments (4)

rpannekoek avatar rpannekoek commented on July 20, 2024

Can you elaborate on the use cases for customizing the XPM markup? Given your proposed design, it seems you have several use cases in mind.
Would it be an option to let PageModel.GetXpmMarkup() call GetXpmScriptMarkup(), which calls GetXpmScriptUrl() in turn (and let DxaPageMarkup() only call PageModel.GetXpmMarkup()) ?

from dxa-web-application-dotnet.

jhorsman avatar jhorsman commented on July 20, 2024

A customization I am working now is to delay loading the XPM script.

Usually the XPM script loads after the page is parsed using <script type="text/javascript" language="javascript" defer="defer" src="https://server/WebUI/Editors/SiteEdit/Views/Bootstrap/Bootstrap.aspx?mode=js" id="tridion.siteedit"></script>. We are using Vue (a frontend scripting framework) to render some views on the frontend. To make sure that XPM components and fields which are inside those Vue views are rendered correctly, we load the XPM script when Vue has rendered all Vue components and the mounted() hook is called.

The XPM page metadata (the XPM HTML comments) can be loaded like usual, but the XPM JavaScript script cannot be loaded with the <script> tag outputted by GetXpmMarkup(). For now I have a custom view helper which renders just the XPM page metadata. A PageModel extension provides the XPM script URL which is passed to the Vue configuration.

from dxa-web-application-dotnet.

jhorsman avatar jhorsman commented on July 20, 2024

@rpannekoek: about the DxaPageMarkup() and other methods. Why not separate the XPM page metadata and the script tag? They do not have to be rendered by the same helper method because they are separate things. The XPM page metadata is similar to the XPM component metadata, it is fine to leave it to the page view or the _Layout view. The XPM script tag could be loaded elsewhere, depending on the implementation.

  • The XPM page markup will be generated by the DxaPageMarkup() helper, calling PageModel.GetXpmMarkup()
  • The XPM script markup will be generated by the DxaScriptMarkup() helper, calling PageModel.GetXpmScriptMarkup(), which calls PageModel.GetXpmScriptUrl()

from dxa-web-application-dotnet.

tommyturkijevic avatar tommyturkijevic commented on July 20, 2024

Has there been any resolution to this issue/suggestion or is this fixed in DXA 2.0 or will it be in DXA 2.1 ?

from dxa-web-application-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.