Re: (WebKit) Encapsulate nodes around selected text
Re: (WebKit) Encapsulate nodes around selected text
- Subject: Re: (WebKit) Encapsulate nodes around selected text
- From: James Housley <email@hidden>
- Date: Mon, 26 Sep 2005 13:30:40 -0400
Wolfgang Schreurs wrote:
I'm busy creating a WYSIWYG web editor. I want it to be easy for the
end user to use this application, so I'm creating a web editor that
looks/works like a text editor (i.e.: Nisus Writer, Word, etc...).
I have some difficulties in creating a method that encapsulates tags
around selected text. A user must be able to make a selection and
press a 'Bold' or 'Italic' button to transform the style. I figured I
should get a selection and the insert a tag before and after the
selection. I've tried using the DOM from Cocoa and from JavaScript
(with the [webview evaluateWebScript] method), but both without
succes.
The DOM model is quite new to me, so any help is greatly appreciated.
applyStyle: is what you want for this.
[web applyStyle:[web styleDeclarationWithText:@"font-weight: bold;"]];
Will either make a selection bold, or start bold typing if there is no
selection.
Jim
--
/"\ ASCII Ribbon Campaign .
\ / - NO HTML/RTF in e-mail .
X - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
email@hidden http://www.FreeBSD.org The Power to Serve
email@hidden http://www.TheHousleys.net
---------------------------------------------------------------------
"Eagles may soar, but weasels don't get sucked into jet engines"
-- Anon
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden