위젯(widget)이라는 용어는 영어로 소형 장치나 요소를 뜻한다.
1980년대에 프로젝트 아테나가 최초로 GUI 요소를 위젯이라고 부르기 시작했다. 다른 비슷한 용어에는 적절하지 못한 뜻이 포함될 수도 있었기 때문에 이 낱말이 선택되었다.
또 이 프로젝트의 Intrinsics 툴킷(Xt 라이브러리)은 X 윈도 시스템 위에서 창과 각 위젯을 연결시켰기 때문에 창과 같은 접두어가 선택되었다고 한다.
Widget
'Widget' - W-I-D-G-E-T. Widget. It has a nice, friendly sound to it. It sounds a bit like it should be a small animal or bird. But it isn’t. What is it then?
A widget can be many things, but most recently the word has come to describe small applications which run on your computer. You might have been given the option to download a widget and wondered what it meant. Widgets can have all sorts of functions – you can download a weather widget, so you can predict the weather (never an exact science in the UK!) or a calendar widget, or a twitter widget. You name it, there’s probably a widget out there which does it.
I first remember hearing the word in the early 1990s from a series of beer adverts. The great thing about the beer’s new can was that it had a widget inside it. This meant that when you opened the can, the beer came out like a draught beer, the beer you get on tap in a pub. How it did this was a mystery to most people. All we knew was that it contained a widget.
'Widget' is thought to have come from the word 'gadget'. The original meaning of this seems to be to describe something that you couldn’t think of the word for. According to some etymologists (people who research the origins of words), 'widget' was a variation of the word 'gadget' which arose in the 1920s or 1930s in the US. Before this, the word 'gadget' seems to have been used by British sailors in the mid to late 19th century to describe something which they had forgotten the word for. Used in this way it may have come from a French word ‘gachette’, meaning a type of lock mechanism. Nobody really seems sure. What we can say though, about both ‘widget’ and ‘gadget’ is that they are normally used for something which is not easy to define exactly, something usually mechanical or more recently in relation to computers.
One of the more intriguing possible origins of the word ‘widget’ can be found in the Routledge dictionary of historical slang which lists the word ‘wifflow-gadget’. The meaning of this and another nice expression ‘hook-me-dinghy’ is apparently ‘anything whose right name has temporarily slipped one’s mind’.
Widgetry, the art of designing widgets, has given rise to a couple more new words, for example, 'widgeteer' – a person who designs widgets, and 'to widgetize' – the process of turning something into a widget.
Window get Selection and ranges
This is the problem i am trying to solve:
1) User uploads a file. (TXT, DOC, DOCX)
2) I parse it and spit out the HTML for the user on a window pane, user selects parts of the text, and clicks on export and i use window.getSelection to create a new pane with that selected text, and ability to comment on that text.
3) User comments.
4) This way i have a collection of Comment boxes, with text and respective comments.
5) Now i want to create a PDF file that has the whole file HTML that i had parsed initially, and i want to plug in the comments on the relevant sections that the user selected and created comment boxes for, as explained in point 3 and 4.
Question:
How do i mash together the selections with comments and the original text to create that PDF.
I think i need to do something with ranges, but i don't quite understand how, what is the data structure i might need?
I am using Node.js
Thanks!
EDIT
Will make it more precise, how do i add a HTML wrapper over the selection, so that i can uniquely identify it, it might get easier from there.