Get selected text or image in ck editor

Some time we need to get selected text or image for ck editor. We can do it easily here is simple code.

 

 var selection = CKEDITOR.instances['content'].getSelection();
 if (selection.getType() == CKEDITOR.SELECTION_ELEMENT) {
 var selectedContent = selection.getSelectedElement().$.outerHTML;
 } else if (selection.getType() == CKEDITOR.SELECTION_TEXT) {
 if (CKEDITOR.env.ie) {
 selection.unlock(true);
 selectedContent = selection.getNative().createRange().text;
 } else {
 selectedContent = selection.getNative();
 console.log("The selectedContent is: " + selectedContent);
 }
 }

if you find any problem then give a comment

Phpstrom Editor Some Important Tips

Phpstrom editor is very good editor for php developer. It alow shows error for css, javascript,html etc. Below it will give some important tips for phpstrom editor.

1. How to increase memory allocation?

Ans : goto your program file where you install phpstrom editor. then goto ->jetBrains->phpstrom version-> bin folder. You will see PhpStorm.exe.vmoptions  file. Open it any editor then you will see 


-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
Just change Xmx 512 m this value. then save it. sometime this file not save normally then save it other folder then replace this in bin folder. Restart phpstrom editor .You will see new define memory in right bottom side.

2. How to show line number ?

Ans: goto file->setting from top menu then you will see a screen . goto <span style="color: #993300;">editor tab-> appearance</span> then you will see

Show line number checkbox . Check it.

3. Goto line number ->Ctrl+g

4. Find Ctrl+f

5. Find and replace Ctrl+r

6. Find in path Ctrl+shift+f

7. Replace in path Ctrl+shift+r

8. Any comment ctrl+shift+/

9. Goto end tag ctrl+}

10. Format code ctrl+alt+l

11. goto include file then click this file name

12. Goto start tag ctrl+{
13. Find total function list and file list which include ctrl+F12
 
For more setting goto file->setting from top menu then go to keymap from "editor->keymap".

Hope this will be helpful

Resource

Web Development Resource

UI and UX Design

User Interface and User Experience

Tutorial

code,Tips,Tricks in php,mysql,javascript,jquery,ajax,yii,yii2,codeigniter,laravel,drupal,slim,bootstrap,api,jQuery Mobile