Permalink
Browse files

Merge pull request #103 from dshafik/add-default-apidocs-markdown-editor

Add default apidocs markdown editor
  • Loading branch information...
2 parents 04f5295 + 489da1f commit 55c7f1fda05a63fcdb3e5e49b838625dc1d46c42 David Coallier committed Feb 22, 2012
Showing with 87 additions and 30,338 deletions.
  1. +3 −0 .gitmodules
  2. +17 −9 src/frapi/admin/application/modules/default/views/scripts/action/code.phtml
  3. +22 −0 src/frapi/admin/application/modules/default/views/scripts/action/edit.phtml
  4. +22 −1 src/frapi/admin/application/modules/default/views/scripts/errors/edit.phtml
  5. +22 −1 src/frapi/admin/application/modules/default/views/scripts/mimetypes/edit.phtml
  6. +0 −1 src/frapi/admin/application/views/layouts/header.phtml
  7. +0 −123 src/frapi/admin/public/bespin/BespinEmbedded.css
  8. +0 −7,856 src/frapi/admin/public/bespin/BespinEmbedded.js
  9. +0 −20,615 src/frapi/admin/public/bespin/BespinMain.js
  10. +0 −952 src/frapi/admin/public/bespin/BespinWorker.js
  11. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/bespin-s.png
  12. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/check-selected.png
  13. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/check-unselected.png
  14. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/lines.png
  15. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/radio-selected.png
  16. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/radio-unselected.png
  17. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/scroll-down.png
  18. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/scroll-left.png
  19. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/scroll-right.png
  20. BIN src/frapi/admin/public/bespin/resources/screen_theme/images/scroll-up.png
  21. +0 −268 src/frapi/admin/public/bespin/resources/screen_theme/theme.less
  22. +0 −512 src/frapi/admin/public/bespin/resources/syntax_directory/php_syntax.js
  23. +1 −0 src/frapi/admin/public/js/ace
View
@@ -0,0 +1,3 @@
+[submodule "src/frapi/admin/public/js/ace"]
+ path = src/frapi/admin/public/js/ace
+ url = git://github.com/ajaxorg/ace.git
@@ -2,20 +2,28 @@
<h2><?php echo $this->tr->_('EDITING_ACTION'); ?>: <?php echo $this->name; ?></h2>
<br />
<br />
-<form method="post" style="width: 750px;">
+<form method="post" style="width: 750px; line-height: 1.2em; letter-spacing: 0;">
<input type="submit" value="<?php echo $this->tr->_('SAVE'); ?>" />
<br />
- <textarea id="edit" name="code" style="width: 750px; height: 500px; font-size: 11px;" ><?php echo $this->content; ?></textarea>
+ <textarea name="code" style="position: relative; width: 687px; margin-left: 45px; height: 500px; font-size: 11px; margin-top: 35px; font-family: 'Monaco','Menlo','Ubuntu Mono','Droid Sans Mono','Consolas',monospace; font-size: 11px;"><?php echo $this->content; ?></textarea>
+ <div id="editor" style="position: relative; width: 750px; height: 500px; font-size: 11px; margin-top: 35px; background-color: #FFF"></div>
<br /><br /><br />
<input type="submit" value="<?php echo $this->tr->_('SAVE'); ?>" />
</form>
+<script type="text/javascript" src="/js/ace/build/src/ace.js"></script>
+ <script src="/js/ace/build/src/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
+ <script src="/js/ace/build/src/mode-php.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
-window.onBespinLoad = function() {
- var edit = document.getElementById('edit');
- bespin.useBespin(edit, {
- stealFocus: true,
- syntax: 'php'
- });
-};
+ window.onload = function() {
+ var editor = ace.edit("editor");
+ var textarea = $('textarea[name="code"]').hide();
+ editor.setTheme("ace/theme/textmate");
+ var PHPMode = require("ace/mode/php").Mode;
+ editor.getSession().setMode(new PHPMode());
+ editor.getSession().setValue(textarea.val());
+ editor.getSession().on('change', function(){
+ textarea.val(editor.getSession().getValue());
+ });
+ };
</script>
@@ -33,6 +33,28 @@ echo $this->form;
</form>
+<script type="text/javascript" src="/js/ace/build/src/ace.js"></script>
+<script src="/js/ace/build/src/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
+<script src="/js/ace/build/src/mode-markdown.js" type="text/javascript" charset="utf-8"></script>
+<script type="text/javascript">
+ $(document).ready(function() {
+ var textarea = $('#description').hide();
+ textarea.after($('<div id="editor" style="position: relative; width: 500px; height: 500px; font-size: 11px; line-height: 1.2em; letter-spacing: 0; background-color: #FFF"></div>'));
+
+ var editor = ace.edit("editor");
+ editor.setTheme("ace/theme/textmate");
+ var MarkdownMode = require("ace/mode/markdown").Mode;
+ editor.getSession().setMode(new MarkdownMode());
+ editor.getSession().setValue(textarea.val());
+ editor.getSession().setUseWrapMode(true);
+ editor.getSession().on('change', function(){
+ textarea.val(editor.getSession().getValue());
+ });
+
+ $('#editor').after($("<p style='margin-left: 185px; margin-top: -1em; font-size: 10px'><em>You may use <a href='http://michelf.com/projects/php-markdown/extra/' target='_blank'>extended markdown</a>.</em></p>"))
+ });
+</script>
+
<script type="text/javascript">
$(document).ready(function() {
var i = <?php echo $i; ?>;
@@ -1 +1,22 @@
-<?php echo $this->form; ?>
+<?php echo $this->form; ?>
+<script type="text/javascript" src="/js/ace/build/src/ace.js"></script>
+<script src="/js/ace/build/src/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
+<script src="/js/ace/build/src/mode-markdown.js" type="text/javascript" charset="utf-8"></script>
+<script type="text/javascript">
+ $(document).ready(function() {
+ var textarea = $('#description').hide();
+ textarea.after($('<div id="editor" style="position: relative; width: 500px; height: 500px; font-size: 11px; line-height: 1.2em; letter-spacing: 0; background-color: #FFF"></div>'));
+
+ var editor = ace.edit("editor");
+ editor.setTheme("ace/theme/textmate");
+ var MarkdownMode = require("ace/mode/markdown").Mode;
+ editor.getSession().setMode(new MarkdownMode());
+ editor.getSession().setValue(textarea.val());
+ editor.getSession().setUseWrapMode(true);
+ editor.getSession().on('change', function(){
+ textarea.val(editor.getSession().getValue());
+ });
+
+ $('#editor').after($("<p style='margin-left: 185px; margin-top: -1em; font-size: 10px'><em>You may use <a href='http://michelf.com/projects/php-markdown/extra/' target='_blank'>extended markdown</a>.</em></p>"))
+ });
+</script>
@@ -1 +1,22 @@
-<?php echo $this->form; ?>
+<?php echo $this->form; ?>
+<script type="text/javascript" src="/js/ace/build/src/ace.js"></script>
+<script src="/js/ace/build/src/theme-textmate.js" type="text/javascript" charset="utf-8"></script>
+<script src="/js/ace/build/src/mode-markdown.js" type="text/javascript" charset="utf-8"></script>
+<script type="text/javascript">
+ $(document).ready(function() {
+ var textarea = $('#description').hide();
+ textarea.after($('<div id="editor" style="position: relative; width: 500px; height: 500px; font-size: 11px; line-height: 1.2em; letter-spacing: 0; background-color: #FFF"></div>'));
+
+ var editor = ace.edit("editor");
+ editor.setTheme("ace/theme/textmate");
+ var MarkdownMode = require("ace/mode/markdown").Mode;
+ editor.getSession().setMode(new MarkdownMode());
+ editor.getSession().setValue(textarea.val());
+ editor.getSession().setUseWrapMode(true);
+ editor.getSession().on('change', function(){
+ textarea.val(editor.getSession().getValue());
+ });
+
+ $('#editor').after($("<p style='margin-left: 185px; margin-top: -1em; font-size: 10px'><em>You may use <a href='http://michelf.com/projects/php-markdown/extra/' target='_blank'>extended markdown</a>.</em></p>"))
+ });
+</script>
@@ -17,7 +17,6 @@
<!--[if lt IE 8]><script src="/scripts/IE8.js" type="text/javascript"></script><![endif]-->
<link id="bespin_base" href="/bespin" />
- <script type="text/javascript" src="/bespin/BespinEmbedded.js"></script>
<title>FRAPI <?php echo $this->tr->_('ADMIN_INTERFACE'); ?></title>
</head>
@@ -1,123 +0,0 @@
-.bespin-completion-panel {
- font-family: Helvetica, Arial, sans-serif;
- position: absolute;
- cursor: default;
- line-height: normal;
- -moz-user-select: none;
- -webkit-user-select: none;
-}
-
-.bespin-completion-pointer {
- position: absolute;
- z-index: 2;
- height: 21px;
- width: 21px;
-}
-
-.bespin-completion-pointer-up {
- top: 1px;
- border-top: solid #555 1px;
- border-left: solid #555 1px;
- background-image: -moz-linear-gradient(top left, #333333, #333333 50%, transparent 50%, transparent);
- background-image: -webkit-gradient(linear, left top, right bottom, from(#333333), color-stop(0.5, #333333), color-stop(0.5, transparent), to(transparent));
- -moz-transform: rotate(45deg);
- -webkit-transform: rotate(45deg);
-}
-
-.bespin-completion-pointer-down {
- bottom: 1px;
- border-top: solid #000 1px;
- border-left: solid #000 1px;
- background-image: -moz-linear-gradient(top left, #000, #000 50%, transparent 50%, transparent);
- background-image: -webkit-gradient(linear, left top, right bottom, from(#000), color-stop(0.5, #000), color-stop(0.5, transparent), to(transparent));
- -moz-transform: rotate(225deg);
- -webkit-transform: rotate(225deg);
-}
-
-.bespin-completion-bubble-outer {
- position: relative;
- z-index: 1;
- margin: 11px 0px 11px 0px;
- border-top: solid #555 1px;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
-}
-
-.bespin-completion-bubble-inner {
- position: relative;
- z-index: 3;
- padding: 6px;
- background: -moz-linear-gradient(top, #333333, #000000);
- background: -webkit-gradient(linear, center top, center bottom, from(#333333), to(#000000));
- color: #ffffff;
- font-size: 10.5pt;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
- -moz-box-shadow: 0px 6px 16px 2px rgba(0, 0, 0, 0.5);
- -webkit-box-shadow: 0px 6px 16px 2px rgba(0, 0, 0, 0.5);
-}
-
-.bespin-completion-panel ul {
- list-style: none;
- margin: 0px;
- padding: 0px;
-}
-
-.bespin-completion-panel li {
- text-indent: 0px;
- margin: 0px;
- padding: 6px 16px;
-}
-
-.bespin-completion-highlight {
- position: absolute;
- z-index: -1;
- background-image: -moz-linear-gradient(top, #3e59be, #312d80);
- background-image: -webkit-gradient(linear, center top, center bottom, from(#3e59be), to(#312d80));
- border: solid rgba(37, 34, 91, 1.0) 1px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
-}
-
-.bespin-completion-kind {
- display: block;
- float: left;
- top: 0px;
- left: 0px;
- width: 8px;
- height: 8px;
- padding: 2px;
- margin: 0px 5px 0px 0px;
- font-size: 6.5pt;
- font-weight: bold;
- text-transform: uppercase;
- text-align: center;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-.bespin-completion-kind-m {
- background-color: maroon;
-}
-
-.bespin-completion-kind-f {
- background-color: green;
-}
-
-.bespin-completion-top-row {
- position: relative;
-}
-
-.bespin-completion-second-row {
- margin: 6px 0px 0px 17px;
- display: none;
-}
-
-.bespin-completion-ident {
- font-weight: bold;
-}
-
-.bespin-completion-container {
- color: #a0a0a0;
-}
-
Oops, something went wrong.

0 comments on commit 55c7f1f

Please sign in to comment.