Closed Bug 810069 Opened 12 years ago Closed 12 years ago

CKEditor button to insert embed macro for a live code sample

Categories

(developer.mozilla.org Graveyard :: Editing, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: openjck, Assigned: davidwalsh)

References

Details

(Whiteboard: p=4)

This is a subtask of bug 797480. In bug 810068, we will build a CKEditor plugin for editing live examples. This bug is about actually building the display for those examples. Quoting Les from bug 797480: > We ... need a way to easily insert the <iframe> for a code sample into > pages, whether it's the same page where the sample was composed or on > a different page entirely.
Here's an example page with a sample on dev: https://developer-dev.allizom.org/en-US/docs/User:lmorchard/TestCodeSample I cheated a bit there, by creating the {{ EmbedLiveSample("id") }} template to make insertion easier. The really important part for a complete solution on this bug, though, would be to have a CKEditor button that: 1) Lets you pick a wiki page (defaulting to the current page) 2) Lets you pick a code sample from the selected page 3) inserts an <iframe> with the URL to the page and selected sample One caveat: #2 will require Kuma-side work to get a list of samples for a given page.
Summary: Display code examples created through CKEditor → CKEditor button to insert <iframe> for a live code sample
Whiteboard: p=
Creating bug 810430 as a blocker: A machine-readable (ie. the JSON view) table of contents listing sections for any given page seems a necessary prerequisite for this button to work completely.
Depends on: 810430
Another thing that occurred to me while rambling in IRC: We should think about building a standard "widget" to wrap around the <iframe> for a code sample, not unlike JSFiddle's. That is, an <iframe> could come along with a caption that offers a button to show sample HTML for embedding on 3rd party sites, maybe also link back to the page where the sample is defined if it's being embedded on a different page. This "widget" could be built in kumascript, and so the button proposed in this bug could just insert something like {{ EmbedLiveSample('Sample_ID', '/page/path') }} and we build the widget in that template But... all the above could be worth filing follow up bugs, and just getting a button to insert a plain clean <iframe> is a good initial win, IMO
Oh, but then again, inserting a kumascript template instead of a bare <iframe> means we can update the template in the future and change code sample embeds across the site without editing individual documents.
Whiteboard: p= → p=4
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
No longer depends on: 810430
No, this is not done. This bug involves a button to insert a live sample embed into a page, from any page. Kind of like inserting a link to one page from another. This is separate from the boilerplate button.
Status: RESOLVED → REOPENED
Depends on: 810430
Resolution: FIXED → ---
Summary: CKEditor button to insert <iframe> for a live code sample → CKEditor button to insert embed macro for a live code sample
In other words, this should result in a button that summons something like the link dialog, allowing the selection of a page and a sample within that page and resulting in the insertion of the appropriate {{ EmbedLiveSample }} macro. Pull #703 does not do that.
Assignee: nobody → dwalsh
Commits pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/22869f651a4aba86e2db088af5d6067ba8199b90 fix bug 810069 - Add sample lookup fix bug 810430 - Provide sections to json view https://github.com/mozilla/kuma/commit/3c963bfab6ac27cb059c6d57e6a0a26eed058bb5 Merge pull request #725 from darkwing/ckeditor-embed-810069 fix bug 810069 - Add button to inject code samples
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Doesn't depend on a structured TOC, just needed a flat list of sections.
No longer depends on: 810430
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.