wysi (not always) wyg (but it can be) - drupalcon denver 2012

31

Upload: andrew-mallis

Post on 15-Jan-2015

55 views

Category:

Technology


0 download

DESCRIPTION

Configuring WYSIWYG editors and image handling is a laborious process, riddled with caveats and best practices. The number of contributed modules extending the WYSIWYG experience is vast, and their configuration can be a quagmire. Likely you're already part of the way with your configuration. This aims to supercharge your approach What we'll cover: - How to consider input format creation. - How (and why) to configure better_formats and wysiwyg_filter. - Inline image options and why you might choose one method over another (IMCE vs insert). - Helper modules and configurations for image handling (filefield_paths, filefield_sources, pathauto , transliteration, insert, image_resize_filter, imce). - Building Features of your configurations, and also pushing configuration into profiles - D6 and D7, but mostly 7. session: http://denver2012.drupal.org/program/sessions/what-you-see-not-always-what-you-get-it-can-be.html video: https://archive.org/details/WhatYouSeeIsnotAlwaysWhatYouGetbutItCanBe google doc wtih the goods http://bit.ly/d7wysiwyg

TRANSCRIPT

Page 1: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012
Page 2: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

WYSI(not always)

WYG(but it can be)

Andrew Mallis

ideograph

Site Building

Page 3: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

d.o./twitter: Andrew_Mallis

[email protected]

ideograph

Page 4: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

‣ context

‣ modules!

‣ arm you with concepts

‣ demo site!

‣ the distro

OUTLINE

Page 5: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

the google doc

http://bit.ly/ideograph-wysiwyg

Page 6: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

whatchu want?

Page 7: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

whatchu get

Page 8: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

the solution…

Page 9: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

LOTS OF MODULES!

Page 10: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012
Page 11: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

text-input

‣ wysiwyg  – the api that enables 3rd party editors

‣ wysiwyg_"lter – input !lter that gives us control over HTML output (think: output !lter)

‣ better_formats – de!ne input formats per content type (mostly in D7 core now) and more

Page 12: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

Media!‣ wysiwyg  – the api that enables 3rd party editors‣ "le"eld_sources – re-use existing !les, upload via URL‣ insert – adds a button to insert images or !le links into

text!elds from image/!le !elds‣ image_resize_"lter – creates on-the-#y image-style/

imagecache derivatives when inline images are resized‣ imce + imce_wysiwyg – con!gurable image/!le

uploader and browser that supports personal & shared directories and quotas

‣ imagecache [6.x] – create derivative images from a single !le for presentation in different contexts

‣ itweak_upload [6.x] – beauti!es !le upload forms

Page 13: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

Paths / SEO‣ pathauto – automatically generates path aliases according to

con!gurable patterns

‣ transliteration – rename !les on upload to use only US-ASCII characters

‣ "le"eld_paths –  use node tokens in destination paths and !lenames

‣ pathologic – input !lter that makes image links in content areas relative (most useful for feeds)

Page 15: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

WYSIWYG FILTER

@[class|style|title],a[href|target<_blank|name|rel], -div[align<center?justify?left?right],#p[align<center?justify?left?right],strong/b,em/i,u,-ol[type|compact],-ul[type|compact],-li,-dl,-dt,-dd,caption,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],br,cite,code,-blockquote,img[src|width|height|align|hspace|vspace], -span[align<center?justify?left?right]

text editor

Page 16: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

ADVANCED RULES

‣ sane block formats

‣ drop-down select “styles”(coordinate with wysiwyg pro"le)

‣ container to "x #oat bugs

Page 17: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

WYSIWYG pro"les

‣ Tame the CSS in the editor

‣ Custom module to add classes to CKEditor <body>

Page 18: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

why ckeditor?

‣ not too scary looking

‣ accessibility

‣ force clean-up on paste

‣ “easy” inclusion of custom styles

‣ everyone else is doing it

Page 19: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

wysiwyg.css

body.cke_show_borders,body.mceContentBody {

/* reset font size or it will cascade */font-size: 1em;

/* just in case the theme sets a background on the body tag */

background: none #FFF;

/* add a bit of spacing so we aren't right to the editor’s edge */ margin: 10px;

}

Page 20: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

ckeditor-con"g.js

CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; config.bodyClass = 'node';}

Page 21: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

MEDIA!

Page 22: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

Media.module is the future,but we live in the present…

Page 23: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

2. images‣ FIELDS

‣ INLINE IMAGES

1. attachments

Page 25: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

DEMO!

http://wysiwyw.ideograph.biz

Page 26: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

the distro

‣ .make "le

‣ simple pro"le

‣ bartik subtheme

‣ custom module

‣ features: articles, view, utility (permissions, con!g)

https://github.com/ideograph/ideograph_wysiwyg-build

Page 27: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

$ drush make ideograph_wysiwyw.make ideograph.wysiwyw

$ cd ideograph.wysiwyw

1. build it

Page 28: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

$ drush site-install ideograph_wysiwyw \ --site-name='WYSIWYG tests' \ --db-url=mysql://dbuser:dbpassword@localhost/database_name \ --db-su=dbuser --db-su-pw=dbpassword \ --account-name=root --account-pass=u1pass \ [email protected]

‣ via UI by selecting the “ideograph wysiwyg” pro"le

‣ or, with drush:

2. install it

Page 29: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

roll your own!

Page 30: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

questions

?

Page 31: WYSI (not always) WYG (but it can be) - Drupalcon Denver 2012

What did you think?Locate this session on theDrupalCon Denver website

http://denver2012.drupal.org/program

Click the “Take the Survey” link.

Thank You!