Translations: English
Search on Docs:
   
ActionItem Search:

#2044: Macros for TinyMCE articles

Type: FeatureItem Feature: ContentManagement Tags: serpro
ScheduledFor: N/A Assigned to: LeandroNunes Sites:  
Priority: 5 Status: Rejected  

inspired: http://codex.wordpress.org/Shortcode_API

Shortcode API, a simple set of functions for creating macro codes for use in post content. For instance, the following shortcode (in the post/page content) would add a photo gallery into the page:

[gallery]

It enables plugin developers to create special kinds of content (e.g. forms, content generators) that users can attach to certain pages by adding the corresponding shortcode into the page text.

The Shortcode API makes it easy to create shortcodes that support attributes like this:

[gallery id="123" size="medium"]

The API handles all the tricky parsing, eliminating the need for writing a custom regular expression for each shortcode. Helper functions are included for setting and fetching default attributes. The API supports both self-closing and enclosing shortcodes.


Isso seria legal porque posso redigir um artigo e chamar para incluir nesse artigo a saída da galeria de imagens ou vídeo.. ou talvez de algum plugin.

-- ValessioBrito - 01 Jul 2011

Nice!

We use the Tiny MCE on the rich-text editor and (i think) we can create special uneditable blocks of content. With that feature we can add this "dynamic content markers" or "Macros" in a more beauty and easily configurable way.

Example:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam convallis lacinia rutrum. Nulla in diam neque, vel molestie eros. Duis ac tellus vitae mi ultrices rutrum. Etiam pellentesque, lectus id ultricies molestie, purus quam dignissim velit, cursus vehicula elit nulla vel neque.

Well… my gallery has this nice pictures:
Gallery Macro
    Display 6 pictures from /user/the-gallery,
    filtered by "nice, cool" tags.

Did you like that? Ut volutpat tincidunt libero eget vulputate. In mattis risus vitae leo porttitor vel auctor tortor pulvinar. Aenean et tortor dui. Fusce accumsan tempor nunc in vulputate. Nullam pulvinar auctor justo sit amet cursus.

A good way to add this is to have a "Macros" button on the Tiny MCE menu where the user will select the macro to add, like we already do with the "new article" or "new content" button on CMS related pages.

Selecting the "macro type" the "macro configuration window" will ask for the parameters. When the user selects the macro and click on the Macros button, the the "macro configuration window" will open, like that happens with images.

The macro block is a patterned html and the root element (a div) must have the data attributes data-macro to set the macro type with a valid symbol name (/[_a-z][_a-z0-9]*/), and may have some data-macro-<parameter-name>, containing the parameters as expected by the macro definition. That data attributes will be the only mandatory and expected thing to make the server recognize macro blocks and replace it's html by the generated code. The inner list on the example is not mandatory and may be replaced by any other content useful for the user.

The html code for this example may be:
<div class="macro mceNonEditable"
     data-macro="gallery"
     data-macro-dir="/user/the-gallery"
     data-macro-limit="6"
     data-macro-filter-tags="nice, cool"
     ...>
  <strong>Gallery Macro</strong>
  <div class="macro-info">
    Display 6 pictures from <code>/user/the-gallery</code>, filtered by _"nice, cool"_ tags.
  </div>
</div>

-- AurelioAHeckert - 01 Jul 2011

To create the special uneditable blocks inside TinyMCE, to the macro definition, use this: http://tinymce.moxiecode.com/wiki.php/Plugin:noneditable
Try it now: http://www.tinymce.com/tryit/noneditable_content.php

-- AurelioAHeckert - 29 Jul 2011

Estou mapeando na internet algumas ideias de Macros para Conteúdo;

O exemplo a seguir, é para demarcar parte do conteúdo qual deve ser somente renderizado para membros da comunidade; ou seja, parte do conteúdo é publico e parte somente renderiza se o usuário estiver logado e fizer parte da comunidade:

[member]

Conteúdo qual somente será renderizado para membros da comunidade.

[/member]

Essa e outras 7 ideias/exemplos de macros, pode ser visto aqui: http://www.devlounge.net/code/7-very-handy-shortcodes-for-wordpress

-- ValessioBrito - 27 Oct 2012

Anotações durante a transmissão do primeiro HackingDay 0.0, foi feita aqui: http://piratepad.net/HackingDayMacrosNoosfero

-- ValessioBrito - 27 Oct 2012

Como adicionar botões customizados no TinyMCE: http://www.tinymce.com/tryit/custom_toolbar_button.php

-- AurelioAHeckert - 09 Nov 2012

This functionality was developed here ActionItem2520

-- LeandroNunes - 05 Mar 2013

Idea Macro to use a clipart on OpenClipart.org - ActionItem2656

-- ValessioBrito - 24 Apr 2013
Add comment
You need to login to be able to comment.
 

ActionItemForm edit

Title Macros for TinyMCE articles
ActionItemType FeatureItem
Priority Medium
Tags serpro
Feature ContentManagement
Plugin
ResponsibleDevelopers LeandroNunes
ScheduledFor N/A
AffectsVersion
Status Rejected
Ticket SAC:
who cares AurelioAHeckert
Topic revision: r1 - 22 May 2015, UnknownUser

irc Talk with Devs Now!

Copyright © 2007-2019 by the Noosfero contributors
Colivre - Cooperativa de Tecnologias Livres