javascript - Launching an editor in HTML documents -
i'd edit html document adding button , launching editor.
for example, add button in html (/abc/def/hello.html),
<button type="button">edit code</button>
and clicking edit button
, want launch editor (textmate example, or other editing software) opening /abc/def/hello.html
.
of course, editing possible machine made /abc/def/hello.html
file.
how can that?
added
if it's not possible open editor, possible store file information clipboard or show dialog box? i'll give name of file, job should easy it's showing file name when user clicks.
you're going need server-side scripting support this.
first invent own mimtype, call application/x-prosseek-edit, make button link script generates 'application/x-prosseek-edit' file (and serves mime type). file should contain machine readable version of how retrieve file , launch in editor. e.g.
<?php header('content-type: application/x-prosseek-edit'); print $_server['document_root'] . $_get['file_to_edit'] . "\n";
then create handler script associate mimetype application (again using php example):
#!/usr/bin/php -q <?php $fname=file_get_contents($argv[1]); exec('/usr/bin/my_editor $fname');
with bit of imagination can define transport mechanisms create local copy of file , copy when editing complete.
Comments
Post a Comment