Current location: Hot Scripts Forums » General Web Coding » JavaScript » BB Editor to WYSIWYG Editor


BB Editor to WYSIWYG Editor

Reply
  #1 (permalink)  
Old 12-04-08, 10:33 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Question BB Editor to WYSIWYG Editor

Any ideas on how a WYSIWYG editor works;

My main problem is retrieving the cursor/carot postion within an IFrame and how I would understand that positions being marked are between code.

I don't need anything too fancy (no need for tables and floating divs, just really making text colour and weights show)

I bought an editor but it had a ton of holes in the security and It was excessive with the functions. So thought since I've successfully build a BB editor (much like this one) I thought I might be able to build a WYSIWYG editor (actually, like this one - click the top right icon on programming talks new thread editor )

Just need some guidance.

Thanks
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #2 (permalink)  
Old 12-07-08, 11:45 PM
infinitylimit's Avatar
infinitylimit infinitylimit is offline
Code Guru
 
Join Date: Jun 2004
Location: Oregon
Posts: 758
Thanks: 0
Thanked 0 Times in 0 Posts
All I have to say is good luck, it might be way more than you realize but here is some code to get you started.

Code:
var text = "";
function getActiveText(e) { 

// Sets text MSIE or Netscape active 
// text based on browser, puts text in form
text = (document.all) ? document.selection.createRange().text : document.getSelection();

document.theform.text.value = text;
return true;
}

document.onmouseup = getActiveText;
if (!document.all) document.captureEvents(Event.MOUSEUP);
//  End -->
This takes all the events of mouseup and runs them through the function above. From there text has what you are looking to change.
__________________
Hawk Enterprises -- Home to PHP games, open-source code, tutorials and free downloads
Reply With Quote
  #3 (permalink)  
Old 12-08-08, 08:58 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the response your the only one who was bold enough to answer my post!

The above function seems to be using the same kind of thing as my current BB editor that checks the selection and applies the bullet code either side.

As far as what I've tried and read the WYSIWYG editor is based on an IFrame which is set to edit mode but the getSelection can not work with an IFrame or so I've been told, is this correct?

Thanks Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
download URL for WYSIWYG editor raji20 Script Requests 2 01-29-07 07:38 AM
WYSIWYG Editor -- Removes Malicious Code zzzBrett Script Requests 0 05-06-06 08:58 AM
WYSIWYG Browser Editor thirdwatch4 Script Requests 2 05-05-06 05:20 AM
WYSIWYG editor for clients TPCpro Script Requests 3 12-02-04 07:44 AM


All times are GMT -5. The time now is 11:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.